What does character set and collation mean exactly?

后端 未结 4 986
后悔当初
后悔当初 2020-11-22 13:29

I can read the MySQL documentation and it\'s pretty clear. But, how does one decide which character set to use? On what data does collation have an effect?

4条回答
  •  鱼传尺愫
    2020-11-22 14:11

    A character encoding is a way to encode characters so that they fit in memory. That is, if the charset is ISO-8859-15, the euro symbol, €, will be encoded as 0xa4, and in UTF-8, it will be 0xe282ac.

    The collation is how to compare characters, in latin9, there are letters as e é è ê f, if sorted by their binary representation, it will go e f é ê è but if the collation is set to, for example, French, you'll have them in the order you thought they would be, which is all of e é è ê are equal, and then f.

提交回复
热议问题