Anything wrong with using windows-1252 instead of UTF-8

后端 未结 3 1449
迷失自我
迷失自我 2020-12-18 04:21

I have a test site that has been using windows-1252 all along. They do need/use some symbols like the square root symbol. And they have no need to display in another langu

3条回答
  •  被撕碎了的回忆
    2020-12-18 04:58

    You claim that Windows-1252 offers everything you need but the √ symbol is a counter-example. You must be using one of these tricks:

    • HTML entities: , or similar
    • Print another character and change the font

    In either case, your solution is not portable: stuff will only display correctly in a properly configured web browser. Everything else (database, JavaScript, text files, plain text e-mail messages...) will not contain the real data.

    Additionally, JSON's only encoding is UTF-8. JavaScript will normally make the conversions for you but you must ensure that all your tool-chain behaves similarly.

    So to answer your main question: there's nothing wrong in using Windows-1252 if that's all you need. The problem is that you already need more than it can offer.

    As about your problems with UTF-8, it's obvious that UTF-8 is a full Unicode encoding so it does meet all the requirements. (Not being able to make it work can your reason to dump it but it isn't a technical reason.) My guess is that, since your current data doesn't have actual square root symbols, switching encodings breaks the trick you were using. You need to:

    1. Find out what current data looks like
    2. Run a one-time search and replace

提交回复
热议问题