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