In CodeIgniter, I’m writing an XML file using write_file function.
write_file('data.xml', $str_xml);
But the encoding of the file is always ANSI. How can I have this
file be encoded to UTF-8 automatically?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
OK, thanks for any suggestion. I’ve just figured it out myself. What I need is the PHP function called “utf8_encode()”. Like this…
Now the file is saved to UTF-8 automatically.