When to use utf-8 and when to use latin1 in MySQL?

后端 未结 8 1689
暖寄归人
暖寄归人 2021-02-13 21:56

I know that MySQL has default of latin1 encoding and apparently it takes 1 byte to store a character in latin1 and 3 bytes to store a character in

8条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-13 22:31

    In my experience, if you plan to support Arabic, Russian, Asian languages or others, the investment in UTF-8 support upfront will pay off down the line. However, depending on your circumstances you may be able to get away with English for a while.

    As for the error, you probably have a key or index field with more than 333 characters, the maximum allowed in MySQL with UTF-8 encoding. See this bug report.

提交回复
热议问题