|
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]
|