且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用Windows-1252而不是UTF-8出现任何问题

更新时间:2023-11-27 13:50:34

Windows 1252是许多固定大小的字符集之一。 Mac有自己的设置。欧洲各地以及世界其他地区都有几个ISO。大多数都有轻微的变化。

Windows 1252 is one of the many many fixed size character sets. Mac has its own set. there are a few ISO for various parts of the Europe and for some other parts of the world. Most of them have slight variations.

好的一点是你有一个固定大小的字符,意思是1个字符= 1个字节,无论什么。

The good point is that you have a fixed-size character, meaning 1 character = 1 byte no matter what.

坏点是:


  • 有些人可能没有安装您的编码

  • 有些人可能会使用稍微不同的编码,导致很少的问题,不太明显,但长期来看非常丑陋

  • 您只能支持几个语言

包括您想要的任何引文。在Windows-1252中,您不能显示俄语,希腊语,波兰语...

That include any citation you would like to make. In windows-1252 you can't display russian, greek, polish ...

UTF-8是1字节上unicode表示的标准编码。它可以代表您可能遇到的绝大多数字符,尽管它是为了基于拉丁语言而设计的,因为其他语言需要更多的存储空间。

UTF-8 is the standard encoding for unicode representation on 1+ bytes. It can represent a very large majority of the characters you may encounter, although it is designed for latin-based languages, as other languages take more storage space.

在XML,JSON和大多数类型的Web服务中,您可能会发现。当您不知道要使用什么编码时,这是一个很好的默认值。它允许限制编码问题的数量,如我虽然在拉丁文1 /否,我使用的是拉丁-9,但是这个人在mac上使用罗马。如果您有超过1人在网站内容上工作,他们的格式可能会有不同的编码,因此您的内容可能会在某些时候被弄乱。

It in used in XML, JSON, and most types of web services you may find. It is a good default when you don't know what encoding to use. It allows to limit the number of encoding issues, such as "I though you were in Latin-1 / No, I was using latin-9, but then this guy on mac used Roman". If you have more than 1 people working on the content of the website, they may have different encodings on their plateforme, and therefore your content may be messed up at some point.

据了解,UTF-8是唯一可以轻松地标准化人们使用的编码的唯一方法,而无需讨论。

UTF-8 is, as far as I know, the only way to easily standardize the encoding used between people without discussion.

典型的例子是,如果你的网站被编码在windows1252中,新的dev有一个mac,你可能会遇到麻烦。

Typical example is, if your website is encoded in windows1252, and the new dev has a mac, you'll probably be in trouble.