PHP files saved as ANSI can be processed correctly by PHP and Apache, but when I save the php into UNICODE, it can't work, how can I make PHP and Apache process PHP files in UNICODE? Thanks!
| SitePoint Sponsor |
PHP files saved as ANSI can be processed correctly by PHP and Apache, but when I save the php into UNICODE, it can't work, how can I make PHP and Apache process PHP files in UNICODE? Thanks!




What do you mean by saying "it can't work"? I assure you that character range used by PHP (ASCII) has the same code points in both ANSI (Windows-1252) and Unicode so there are no issues.
There may be an issue with "output has already been sent" if you're saving your Unicode files with BOM (you should save without it).
Pawel Decowski (you should follow me on Twitter)
ansi is not an encoding, it's an organisation. Did you mean ascii, which is a charset and an encoding, created by the ansi organisation? Or perhaps you mean iso-8859-1, which is another charset/encoding, incidentally being a superset of ascii.
Unicode is not an encoding either - It's a charset. There are several encodings capable of representing the unicode charset. For example utf-8.
Most encodings - including those capable of representing unicode - are ascii-compatible.
php is mostly ignorant of encodings, as long as they are ascii-compatible.





ANSI refers to cp1252 in the Windows world and it persists from the past. A lot of Windows software still call cp1252 ANSI.
Bookmarks