ID: 50167 User updated by: oliviapurvis at yahoo dot com Reported By: oliviapurvis at yahoo dot com -Status: Feedback +Status: Open Bug Type: Output Control Operating System: Centos 5.3 PHP Version: 5.3.0 New Comment:
Oops, you're right. It was the apache "AddDefaultCharset UTF-8" directive that was causing this. I upgraded both my Apache and PHP so didn't know which one causes this as the new apache RPM defaulted to UTF-8 while the previous one was off. I wanted to disable the charset response because it was overriding whatever charset I put in the Meta tag of the HTML webpages. Anyway, thanks. Previous Comments: ------------------------------------------------------------------------ [2009-11-13 21:24:25] ras...@php.net Are you sure it isn't set by your Web server? Apache has a default charset setting as well. You should also be aware that it is extremely insecure to not set a charset on every response. IE will end up guessing and that guess can be forced to something like UTF7 by the user by entering text that looks like UTF7. That means that any input filtering you might have in place that assumes things are in iso-8859-1 or utf-8 will be completely ineffective. ------------------------------------------------------------------------ [2009-11-13 16:00:35] oliviapurvis at yahoo dot com Description: ------------ According to the PHP manual: To disable sending of the charset, simply set default_charset to be empty. I set it to empty but the http header always output: Content-Type: text/html; charset=UTF-8 This inteferes with my html pages which has this html header: <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> Only occurs with PHP 5.3. Works correctly with 5.2. By the way, if I set default_charset="iso-8859-1" it produces correctly: Content-Type: text/html; charset=iso-8859-1 But what I want is to disable charset completely. Reproduce code: --------------- <?php echo 'This is a test!'; exit; ?> Expected result: ---------------- Transfer-Encoding: chunked Content-Type: text/html 200 OK Actual result: -------------- Transfer-Encoding: chunked Content-Type: text/html; charset=UTF-8 200 OK ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=50167&edit=1