BOM at PHP file won't get handled with zend.multibyte

时间:2015-06-25 10:01:52

标签: php utf-8

My favorite PHP editor Codelobster is always adding a UTF-8 BOM at my PHP files.

So this BOM is sent to the clients. While it works fine with most browsers, Google Chrome has a problem with it: According to the inspector, it adds &#65279; into the <body> of the HTML, resulting in an ugly padding above the follow-up <form> .

enter image description here

I want to solve this problem by stripping the UTF-8 from the HTTP-Output.

I have read that setting zend.multibyte = On in the PHP.ini will handle the UTF-8 BOM of the PHP files, and therefore avoid passing them to the client.

But it doesn't work. What should I do?

reproduction.php (in ASCII representation)

<?php

// Just a demonstration to show that the UTF-8 BOM was actually sent
flush();
header('abc:def'); // will fail, because of the previously sent BOM

// Now check that the change in the PHP file did work.
var_dump(ini_get('zend.multibyte')); // string(1) "1"

?>

Additional information about the environment:

  • PHP 5.6.8
  • SAPI: Apache 2.0 Handler
  • Apache 2.4.10
  • Windows server

0 个答案:

没有答案
相关问题