Search code examples
c#mysqlxmldappercyrillic

Dapper, XmlDocument and Cyrillic symbols


There are XmlDocument, Dapper, MySql, table's field longtext utf8mb4 and connection charset=utf8mb4.

Using Dapper XmlDocument is inserted and selected from the database. It works fine if there are no cyrillic characters in the xml document. But if the xml document contains cyrillic characters, the document is not completely written, losing the characters at the end.

Is it a bug in dapper? How to fix?


Solution

  • I found sample code to reproduce your problem at https://github.com/StackExchange/Dapper/issues/1303.

    When I ran it with MySql.Data 8.0.17, the XML was truncated, as described. When I switched to MySqlConnector, the code worked as expected.

    If you want to report a bug in MySql.Data (aka MySQL Connector/NET) and wait for a fix, the bug reporting site is https://bugs.mysql.com/.

    Otherwise, I would recommend switching to MySqlConnector as it is more stable and fixes many Connector/NET bugs.