Jump to content

Bite Order Mark


ip2long

Recommended Posts

Hello!

 

Prompt the decision of my problem.

I do a site, and I use sheaf XML + XSLT (all files in the coding utf-8), under Windows.

 

A problem: at the established coding of a conclusion in a xslt-pattern distinct from utf-8, for example windows-1251 I receive symbols BOM in a conclusion of the buffer.

 

To get rid of it to me function does not help:

 

ob_start ('ob');
function ob ($buffer) {
//kill byte order mark
$buffer = preg_replace ('@\xef\xbb\xbf@', ", $buffer);
return trim ($buffer);
}

 

It is very strange as if to check so:

 

$firstchar = substr ($buffer, 0, 1);

 

the first symbol will be ` <` - in my case it ` <! DOCTYPE ht... `, that is after work of a method transformToXML in a conclusion it is impossible to define presence BOM (and it there is)!

 

As the conclusion turns out in the coding windows-1251, and in the buffer remains BOM a browser breaks display, including what it to it has come utf-8.

 

It is inconvenient me manually delete BOM from files php as periodically I hands correct them in a notepade for windows.

Why it is not visible BOM in buffer?

Link to comment
https://forums.phpfreaks.com/topic/55082-bite-order-mark/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.