本文介绍了PHP,将UTF-8转换为ASCII 8位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过使用 iconv 函数将字符串从UTF-8转换为ASCII 8位。该字符串意图导入到会计软件(根据SIE标准分析的一些基本说明)。



我现在正在运行:

  iconv(UTF-8,ASCII,$ this-> _output)
pre>

这适用于会计软件#1,但软件#2抱怨编码。指定的标准编码是: IBM PC 8位扩展ASCII(Codepage 437)



我的问题是,什么版本的ASCII是PHP编码我的字符串,如果不是指定的 - 如何编码字符串相应的标准规范?

解决方案

尝试这个软件#2

  iconv(UTF-8,CP437,$ this - > _output); 

扩展ASCII与普通ASCII不同。
第一个可能接受ASCII,但第二个软件需要扩展ASCII - Codepage 437



看到这个


I'm trying to convert a string from UTF-8 to ASCII 8-bit by using the iconv function. The string is meant to be imported into an accounting software (some basic instructions parsed accordingly to SIE standards).

What I'm running now:

iconv("UTF-8", "ASCII", $this->_output)

This works for accounting software #1, but software #2 complains about the encoding. Specified encoding by the standard is: IBM PC 8-bit extended ASCII (Codepage 437).

My question is, what version of ASCII is PHP encoding my string into, and if other than specified - how can I encode the string accordingly to the standard specification?

解决方案

try this for the software #2

iconv("UTF-8", "CP437", $this->_output);

Extended ASCII is not the same as plain ASCII.The first one maybe accepts ASCII, but the second software requires Extended ASCII - Codepage 437

see this link

这篇关于PHP,将UTF-8转换为ASCII 8位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-29 02:46