The text encoding output by the PHPfwrite function is ANSI, brother, I need UTF-8

The text encoding output by the PHP fwrite function is ANSI, and I need UTF-8 $xmlCOntent= ‘Assume that this string is a well-formed XML text message that includes special characters’; // mb_detect_encoding($xmlContent) is used here; the output result is UTF-8 // Write file$xmlFile = fopen(“file.xml” ,”w”);fwrite($xmlFile,$xmlContent);fclose($xmlFile); In addition, the referenced global configuration file is as follows Set header(“Content-Type:text/html; charset=UTF-8”); Open the file.xml file with Notepad and save it as. The ANSI encoding is displayed I need to save file.xml as UTF-8, how to change the code? ——Solution——————– Indeed, I have tested your code. No problem on my end. . Check it carefully. PHP file, echo mb_detect_encoding($xmlContent); whether it is utf-8

The text encoding output by the PHPfwrite function is ANSI, brother, I need UTF-8

The text encoding output by the PHP fwrite function is ANSI, and I need UTF-8 $xmlCOntent= ‘Assume that this string is a well-formed XML text message that includes special characters’; // mb_detect_encoding($xmlContent) is used here; the output result is UTF-8 // Write file$xmlFile = fopen(“file.xml” ,”w”);fwrite($xmlFile,$xmlContent);fclose($xmlFile); In addition, the referenced global configuration file is as follows Set header(“Content-Type:text/html; charset=UTF-8”); Open the file.xml file with Notepad and save it as. The ANSI encoding is displayed I need to save file.xml as UTF-8, how to change the code? ——Solution——————– Indeed, I have tested your code. No problem on my end. . Check it carefully. PHP file, echo mb_detect_encoding($xmlContent); whether it is utf-8

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: 34331943@QQ.com

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索