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

Posted by Jon M. on 04/23/05 05:23

"Richard Lynch" <ceo@l-i-e.com> wrote in message
news:4029.67.184.124.249.1114151797.squirrel@www.l-i-e.com...
> On Thu, April 21, 2005 5:07 pm, Jon M. said:
>> I am trying to have a file that I generated with PHP saved as UTF-8
>> without
>> the BOM (Byte Order Mark). Does PHP do anything like this? I am a
>> beginner
>> with PHP, but very technically experienced otherwise. I'm talking about
>> the
>> FILE encoding here -just to be clear.
>>
>> e.g. fopen("what_ever_file", "a+") now I want PHP save the file itself
>> with
>> UTF-8, NOT system default.
>>
>> I have searched for hours to find an answer, but have not found any info
>> on
>> the subject.
>>
>> Does PHP have any ability to create a text file saved in UTF-8
>> encoding???
>
> Maybe I'm just being dumb, but I think if you UTF-8 encode your data, and
> http://php.net/fwrite it, you're gonna get what you want...
>
> Dunno about the Byte-Order-Mark part, but I guess you could strip it out
> of the UTF-8 encoded data before writing, if you wanted to.
>
> --
> Like Music?
> http://l-i-e.com/artists.htm


That was the first thing I tried, and it doesn't seem to work (it always
saves in windows default encoding). Unless I missing something about what
you can do with fwrite. Did you actually test that before you replied, and
found that it would? If so, how? The Byte Order Mark is a part of the binary
file that is written, how would one go about stripping it out??

BTW, note to PHP developers: If "fwrite" had a "encoding" parameter, e.g.
"UTF-8", that would be REALLY handy.

 

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

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