PHPfwrite function output text encoding for ANSI, younger brother I need UTF-8
Source: Internet
Author: User
The text output by the PHPfwrite function is encoded as ANSI, and I need to UTF-8 $ xmlContent = 'suppose this string contains a well-formatted XML text message, which contains special characters '; // here using mb_detect_encoding ($ xmlContent); the output result is the UTF-8 // write file $ xmlF PHP fwrite function output the text encoding to ANSI, I need UTF-8
$ XmlContent = 'Suppose this string contains a well-formatted XML text, including special characters ';
// Use mb_detect_encoding ($ xmlContent) here; the output result is a UTF-8
In addition, the referenced global configuration file has such settings header ("Content-Type: text/html; charset = UTF-8 ");
Open the file. xml file in Notepad, save it as, and display ANSI code
I need to save file. xml as a UTF-8, how to change the code?
------ Solution --------------------
Indeed, I have tested your code. I have no problem here ..
Check it carefully. Php file, echo mb_detect_encoding ($ xmlContent); whether it is UTF-8
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service