You are here: Re: Can you fwrite() using utf-8 encoding? « PHP Programming Language « IT news, forums, messages
Re: Can you fwrite() using utf-8 encoding?

Posted by Robin Haswell on 01/19/06 13:15

On Wed, 06 Jul 2005 19:22:12 -0400, Sugapablo wrote:

> I want to have php write some files in utf-8 encoding (foreign characters
> are part of the text).
>
> What's the best method for doing this? fwrite() doesn't seem to work.

If your string is in the correct format, then $fp = fopen("file.txt",
"wb"); fwrite($fp, $string) will write the file in the exact same format
your string is. However, considering PHP's Unicode support is.. well..
appalling, I'm guessing your real problem is that PHP has the the wrong
character encoding in the first place. You could try utf8_encode() on your
$string first..

-Rob

 

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

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