|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-02-07 08:46 UTC] bugzilla at jellycan dot com
Problem: When a php file is saved in utf-8 format with the UTF-8 BOM as the first three bytes of the file (EF BB BF), PHP doesn't ignore these bytes when loading and compiling the file, but instead considers them output coming prior to the <?php. This causes incorrect display of the page and failure of any http header output. It does this even when the internal character format is set in php.ini to be utf-8. Desired outcome: PHP recognizes the utf-8 bom and disregards it. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 14:00:01 2025 UTC |
Adding '--enable-zend-multibyte' to latest PHP5 port for FreeBSD for sure solves the problem: All files contain: <? header("Content-Language: it"); echo "??????\n"; ?> cyberx [~] $ php /usr/tmp/utf8-bom.php ? èéìòù cyberx [~] $ php /usr/tmp/utf8Y-bom.php ?????? cyberx [~] $ php /usr/tmp/utf16-bom.php ?????? cyberx [~] $ php /usr/tmp/utf16BE-bom.php ?????? cyberx [~] $ php /usr/tmp/utf16LE-bom.php ?????? Except for "UTF8 without BOM" that is, of course, not distinguishable from ISO8859-15 (default here), all theother formats are correctly interpreted and outputted. (notice that the 'header' instruction prior of the 'echo' one would stutter with a non-BOM-aware PHP compile). I wonder if and when this great multibyte support would be available by default in Win32 compiles, I would really use it for work and am not willing to but VisualC just to compile that ;-) (though I'm trying compiling it with cygwin's gcc using '-mno-cygwin' option, we'll see...)