Bug #64831 | UTF-8 data interpreted as Latin1 | ||
---|---|---|---|
Submitted: | 1 Apr 2012 18:57 | Modified: | 3 Apr 2012 5:49 |
Reporter: | K. Brooke Nelson | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | Connector / J | Severity: | S2 (Serious) |
Version: | 5.2.38 CE | OS: | Windows (Windows 7 (64-bit)) |
Assigned to: | CPU Architecture: | Any |
[1 Apr 2012 18:57]
K. Brooke Nelson
[1 Apr 2012 19:03]
Valeriy Kravchuk
Are you really sure that set names utf8; does not work any more?
[1 Apr 2012 19:22]
K. Brooke Nelson
In response to the question: "Are you really sure that set names utf8; does not work any more?", I always get an exception thrown with the folloing message: "SET NAMES not allowed by driver". My driver string is "com.mysql.jdbc.Driver".
[2 Apr 2012 6:40]
Valeriy Kravchuk
So, you use Connector/J (not Workbench) when you get the problem. What exact version of Connector/J do you use? What exact URL do you use? Check http://dev.mysql.com/doc/refman/5.5/en/connector-j-reference-configuration-properties.html for characterSetResults and other connection properties that may help to get tutf-8 data properly.
[2 Apr 2012 19:02]
K. Brooke Nelson
I am using MySQL ODBC 5.1 Driver. I keep my driver and url info in an external properties file: mysql.url=jdbc:odbc:NelsonFamily_MySQL mysql.driver=com.mysql.jdbc.Driver 'NelsonFamily_MySQL' is, of course, the name of my DSN. The only non-default setting I have in the DSN is 'Character set: utf8'. I tried to connect via a normal url, but my queries fail giving me an error message which is a paragraph long. The DSN connection allows all my SQL to work.
[2 Apr 2012 22:07]
K. Brooke Nelson
I figured out why I could not use the non-DSN connect string. It was due to the use of refreshRow() in my program which was preventing my queries from working. I comment out the refreshRow statements and everything works fine. I had tried to add options "?CharSet=utf8&useUnicode=true&characterEncoding=utf8" to the DSN version of the connection url, but they caused my program to terminate. When the same options are applied to the non-DSN url, my character corruption problem disappears: I can now read utf-8 data and update it correctly. Thanks for the assistance.
[3 Apr 2012 5:49]
Valeriy Kravchuk
Looks like the problem was not related to any bug in MySQL software.