Re: Is it possible to save a file with UTF-8 encoding and noBOM using PHP?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jon M. wrote:
No matter what I do to the strings to encode them in whatever format before using "fwrite", it ALWAYS seems to end up writing the actual file in "iso-8859-1".

Isn't the encoding of the characters in PHP's strings, and the encoding of the actual binary file on your hard drive, two totally different things? Or am I just misinformed?

A file is completely defined by its contents. If you fwrite UTF-8 data to the file, then it is a UTF-8 file. Whether your editor, or whatever it is you are using to determine the file is being written as iso-8859-1 is smart enough to pick this up is a completely different question.


Why don't you try creating the same contents with PHP and with your preferred text editor and then compare the contents. Perhaps your editor is dropping a hint somewhere in it that you are not writing to the file from PHP.

-Rasmus

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux