Could not successfully convert UCS-2 string to UTF-8
We were performing a massive data migration at work from MSSQL to MySQL using the Migration Wizard in MySQL Workbench. When performing the step that copied the data from one server to the other, we got the following error for some nvarchar
columns:
Could not successfully convert UCS-2 string to UTF-8
Or alternatively, we also got Error during charset conversion of wstring: No error
. This infuriating error took us an hour and a half to diagnose and work around. I finally stumbled upon this link to a bug on the MySQL bugs website relating to MySQL Workbench http://bugs.mysql.com/bug.php?id=69629.
The problem, it turns out, lays with Microsoft’s ODBC Drivers:
This bug is triggered due to improper UCS-2 strings being generated by Microsoft’s ODBC drivers.
And the solution is to select the FreeTDS ODBC Drivers in the first step of the migration wizard of MySQL Workbench. The migration then works perfectly with no further encoding complaints. I hope this helps someone else out with this frustrating problem!