Bug #43471 | error when insert a 4bytes utf8 word(s) | ||
---|---|---|---|
Submitted: | 7 Mar 2009 12:47 | Modified: | 8 Mar 2009 7:23 |
Reporter: | li sx | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | Connector / J | Severity: | S1 (Critical) |
Version: | 5.1.7 | OS: | Windows |
Assigned to: | CPU Architecture: | Any | |
Tags: | 4bytes utf8 insert |
[7 Mar 2009 12:47]
li sx
[7 Mar 2009 22:43]
Mark Matthews
MySQL versions earlier than 6.0 don't support 4-byte UTF-8. The driver sets the sql_mode to 'strict_trans_tables', which means you'll get a truncation error when you try and use unicode characters that are represented with more than 3 bytes in utf-8. Your encodings *may* work from the command-line client, but it's just sheer luck. You might have other sequences of characters that do not "round-trip".
[8 Mar 2009 7:23]
li sx
thx for your answers.so quick! now I must use blob column to save the 4bytes.and then,I download the mysql-6.0.9-alpha-community,try the test(Unicode.java) now I see no problem,but when the word insert into the table,it is not the word before,it is sub of before,see like "?". and I use client insert two words,one is 3bytes the other is 4bytes,then,I use select length(name) from ucode1; type the length of the words,3bytes one return 3,and 4bytes is 6.I hope they will return the same number. so I do not know is it a problem of mysql or the connector? last,the configs of mysql-6xxx are utf8,is it right?or set utf8mb3 or other?
[20 Aug 2010 12:40]
Mohammed Saleem
I have searched for a solution for this, found something might be interesting: <a href="http://abusleem.net/2010/storing-4-bytes-utf8-characters-in-mysql/">storing-4-bytes-utf8-characters-in-mysql</a>