Re-encoding Files to UTF-8
You have a collection of files that aren't in UTF-8 encoding, and you're in the process of converting your site to use UTF-8. To facilitate this transition, you've devised a simple script that reads in the files and saves them in UTF-8, but the resultant files retain their old encoding.
Here's the script in question:
To successfully save the files in UTF-8 encoding, you need to add the UTF-8 Byte Order Mark (BOM) to the beginning of each file:
With this addition, your script will effectively encode the output files in UTF-8, ensuring compatibility with modern web standards.
The above is the detailed content of Why Are My Re-Encoded Files Still Using Their Old Encoding?. For more information, please follow other related articles on the PHP Chinese website!