Meta charset windows-1252 vs utf-8
My HTML pages use <meta charset="windows-1252"> .
- Is it recommended to change
UTF-8and why? - I checked some of my pages with
UTF-8and got question marks with some math symbols. EG: x should be changed to & times; to display correctly. I triedCpConverter, but it did not convert all characters well.
Is there a better way to convert many files?
- UTF-8 is usually the standard that works everywhere. Windows-any encoding depends on Windows and is not guaranteed to work on any computer. Also, look here and here.
- If you want to change the encoding of a file, you can do this in many ways. You can search for the type of encoding in a text editor / IDE or use the following command (not verified, it should work):
iconv -f WINDOWS-1252 -t UTF-8 filename.txt
This is an old question, but my answer may help someone solve it better.
Switching from ANSI (windows-1252) to UTF-8 roughly doubles the size of HTML files. (Depending on the characters used in the file)
If you want to verify this, simply create a file in notepad with the following characters:
الف
These characters are present in both ANSI (Windows-1256) and Unicode. Save the file once with ANSI encoding (Windows-1256) and again with UTF-8 encoding.
UTF-8 file size: 9 bytes
ANSI File Size (Windows-1256): 3 bytes
if you want to change the encoding of your page, just open them in notepad or any other editor and save as in UTF-8 encoding.