#33198 [Opn->Fbk]: Leading UTF-8 byte order mark yields different character encodings in output
| From: | tony2001@php.net | Date: | Wed, 15 Jun 2005 19:10:52 +0000 |
| Subject: | #33198 [Opn->Fbk]: Leading UTF-8 byte order mark yields different character encodings in output | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-80396@lists.php.net to get a copy of this message | ||
ID: 33198
Updated by: tony2001@php.net
Reported By: Bjorn dot Wiberg at its dot uu dot se
-Status: Open
+Status: Feedback
-Bug Type: mbstring related
+Bug Type: Unknown/Other Function
Operating System: IBM AIX 5.2.0.0 ML5
PHP Version: 5.0.4
New Comment:
And if you change *.php to *.<something_else> it still b0rks?
Why do you think it's PHPs fault?
From what I can see, there is no PHP functions involved at all.
Previous Comments:
------------------------------------------------------------------------
[2005-05-31 09:42:51] Bjorn dot Wiberg at its dot uu dot se
Description:
------------
When a PHP/PHTML file (a file getting parsed by PHP) contains a leading
UTF-8 Byte Order Mark (BOM), EF BB BF in hex, the character encoding of
the output varies.
Possibly relevant PHP configuration snippets from httpd.conf:
php_value default_charset none
php_value default_mimetype "text/html"
php_admin_value output_buffering 4096
php_admin_value output_handler none
PHP configuration flags (from config.nice):
CPPFLAGS='-I/usr/local/include' \
LDFLAGS='-L/lib -L/opt/freeware/lib -L/usr/local/lib' \
CC='/usr/local/bin/gcc' \
'./configure' \
'--enable-bcmath' \
'--enable-calendar' \
'--enable-dba' \
'--enable-dbase' \
'--enable-dbx' \
'--enable-debug' \
'--enable-dio' \
'--enable-exif' \
'--enable-embedded-mysqli' \
'--enable-filepro' \
'--enable-ftp' \
'--enable-gd-jis-conv' \
'--enable-gd-native-ttf' \
'--enable-mbstring' \
'--enable-memory-limit' \
'--enable-shmop' \
'--enable-soap' \
'--enable-sockets' \
'--enable-sysvmsg' \
'--enable-sysvsem' \
'--enable-sysvshm' \
'--enable-yp' \
'--enable-zend-multibyte' \
'--prefix=/apache/php' \
'--with-apxs2=/apache/bin/apxs' \
'--with-bz2' \
'--with-freetype-dir' \
'--with-gd' \
'--with-gdbm' \
'--with-gettext' \
'--with-inifile' \
'--with-jpeg-dir' \
'--with-ldap' \
'--with-libxml-dir' \
'--with-mime-magic' \
'--with-mysql=/usr/local/mysql' \
'--with-openssl=/opt/freeware' \
'--with-png-dir' \
'--with-tiff-dir' \
'--with-ttf' \
'--with-xpm-dir' \
'--with-zlib' \
'--with-zlib-dir' \
"$@"
Reproduce code:
---------------
Source code with leading BOM:
http://www.anst.uu.se/bwiberg/php/utf8_bug.php.txt
Corresponding page yielding varying result:
http://www.anst.uu.se/bwiberg/php/utf8_bug.php
(Use telnet or other "dumb" tool to dump the results; it appears that
the result varies by server process that handles the request. We're
using the Apache 2 prefork MPM.)
Example of incorrect result, here we get ISO-8859-1 encoded output:
http://www.anst.uu.se/bwiberg/php/utf8_bug_result1.txt
Expected result:
----------------
Example of correct result, here we get UTF-8 encoded output:
http://www.anst.uu.se/bwiberg/php/utf8_bug_result2.txt
Actual result:
--------------
Varies between the two examples. Make sure to close the connection in
between (or the same server process will serve your multiple
requests).
Restarting the web server does not help.
Changing the PHP settings for default character set (default_charset)
and default MIME type (default_mimetype) does not help; I have tried
all combinations.
Turning off output buffering (php_admin_flag output_buffering off) does
not help.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=33198&edit=1