Page 1 of 1

txt in UTF-8 format

Posted: Tue Jun 20, 2006 5:18 am
by aetoc
I create a file with fopen and I want to save it in UTF-8 format.
The creation is made by request from the user.

Can anyone help me?

Posted: Tue Jun 20, 2006 8:26 am
by feyd
Write a BOM (Byte-order marker) then the rest of the file. A BOM isn't explicitly required, but is a good idea if the file is to be used with a program that does understand UTF-8. You may need to convert the incoming text to UTF-8, so look at mb_convert_encoding().