Bug #89290 | Connector returns JSON-Column value in wrong encoding | ||
---|---|---|---|
Submitted: | 17 Jan 2018 16:39 | Modified: | 23 Jan 2018 6:40 |
Reporter: | Andreas Baier | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | Connector / NET | Severity: | S3 (Non-critical) |
Version: | 6.10.5.0 | OS: | Windows |
Assigned to: | CPU Architecture: | Any | |
Tags: | json, System.String, utf8 |
[17 Jan 2018 16:39]
Andreas Baier
[18 Jan 2018 10:02]
Chiranjeevi Battula
Hello Andreas Baier, Thank you for the bug report testcase. I could not repeat the issue at our end using with Visual Studio 2015, MySQL 5.7.20 and Connector/NET 6.10.5 version. Thanks, Chiranjeevi.
[18 Jan 2018 10:02]
Chiranjeevi Battula
Screenshot
Attachment: Bug_89290.png (image/png, text), 95.39 KiB.
[18 Jan 2018 16:17]
Andreas Baier
Thanks for watching the bug. Maybe I chose an unsuitable character. Can u repeat the test with the follwing INSERT: INSERT INTO `test`.`tbljsontest` (`Json`) VALUES ('{"Key": "äÄöÖüÜ"}'); The hex value output at MySql-Workbench is atteched in the screenshot. These german characters are output in this way: {"Key": "äÄöÖüÜ"} I use Visual Studio 2017, .Net-Framework 4.6.2, Connector 6.10.5.0 on Windows 10 x64
[18 Jan 2018 16:18]
Andreas Baier
Hex Value in MySql Workbench
Attachment: 02.PNG (image/png, text), 4.11 KiB.
[18 Jan 2018 16:19]
Andreas Baier
Output in Visual Studio 2017
Attachment: 01.PNG (image/png, text), 41.71 KiB.
[19 Jan 2018 7:02]
Bradley Grainger
I can reproduce this if mysqld is started with --character-set-server=latin1 When that server option is set, it doesn't matter if the client sets MySqlConnectionStringBuilder.CharacterSet = "utf8mb4" (or "utf8"); it doesn't matter if the client executes "SET NAMES utf8mb4;". No matter what I tried, the UTF-8 bytes being sent on the wire were being misinterpreted as Latin1 by Connector/NET. This definitely looks like a connector bug to me (because MySqlConnector is handling it correctly with the same --character-set-server setting).
[20 Jan 2018 12:03]
Andreas Baier
I can reproduce what Bradley Grainger commented: Only with the option character_set_server = utf8mb4 the connector returns the correct string. For me, it's a bug in Connector/NET to handle JSON values.
[23 Jan 2018 6:40]
Chiranjeevi Battula
Hello Andreas Baier, Thank you for the feedback. Verified based on internal discussion with dev's. Thanks, Chiranjeevi.