[英]Using UTF-8 for MySQL
如果假设一字节字符不能正确用于Unicode字符,那么在MySQL中使用UTF-8之前我们需要注意什么?
There are no single-byte 8-bit encoding in utf8. utf8中没有单字节8位编码。 All are 2, 3, or 4 bytes long.
全部为2、3或4个字节长。
For example, is your data containing a single-byte 8-bit encoding such as hex E9 for an é instead of the 2-byte hex C3A9? 例如,您的数据是否包含单字节8位编码(例如é的十六进制E9)而不是2字节十六进制C3A9? In that case you need to say your client has "latin1" by saying
SET NAMES latin1
, or the equivalent in your client language. 在这种情况下,您需要说
SET NAMES latin1
或您的客户语言中的等效语言,以表示您的客户具有“ latin1”。
If you have C3A9, then you need SET NAMES utf8
. 如果您具有C3A9,则需要
SET NAMES utf8
。
Your table needs to have CHARACTER SET utf8
either on the table or the column(s). 您的表需要在表或列上具有
CHARACTER SET utf8
。
If this does not address your question, please elaborate. 如果这不能解决您的问题,请详细说明。
A lot more discussion is found in my charset blog . 在我的charset博客中找到了更多讨论。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.