You are here: Re: [PHP] Is it possible to save a file with UTF-8 encoding and noBOM using PHP? « PHP « IT news, forums, messages
Re: [PHP] Is it possible to save a file with UTF-8 encoding and noBOM using PHP?

Posted by Rasmus Lerdorf on 04/30/05 04:27

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация