Jump to content

Saving files with utf-8 file encoding?


random1

Recommended Posts

My Code is:

 

<?php
$myString = "Test with accents éèàç На берегу пустынных волн து எங்கும் கா शक्नोम्यत्तुम् । زه شيشه خوړلې";
$fh=fopen('test.xml',"w");
fwrite($fh,utf8_encode($myString));
fclose($fh);
?>

 

Output from that is:

 

éèàç Ðа берегу пуÑтынных волн த௠எஙà¯à®•à¯à®®à¯ கா शकà¥à¤¨à¥‹à¤®à¥à¤¯à¤¤à¥à¤¤à¥à¤®à¥ । زه شيشه خوړلÛ

 

but is saved as utf-8.

just a set of questions:

 

1. what language are you working on?

2. since the string you place there were static, what encoding was used to save that php script that has that string?

3. if it is encoded from a different charset, try using mb_convert_encoding().

 

maybe along the way you might find an answer here or else, please post your answer, I'll try my best to help :).

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.