Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Not a Bug
-
3.0.6
-
None
-
Windows
Description
In ma_platform_win32.c in the MADB_ConvertFromWChar() function WideCharToMultiByte() is called with cc->CodePage instead of CP_UTF8 which makes WideCharToMultiByte() to convert the Wide Unicode data to whatever codepage the ODBC driver is executed on (unsure if this is copied from the calling application or if the driver keeps the system code page) instead of UTF-8 which is the most likely character set that the MariaDB server is expecting.
It looks like the developer thought that the CodePage argument to WideCharToMultiByte() was the codepage of the source when it really is the destination (i.e which code page the resulting multibyte data should be in).
I noticed this recently when trying out ODBC with various sql servers and MySQL 8.0, PostgreSQL 11 and MSSQL 2017 all worked like intended (i.e use the Unicode functions of ODBC to send all possible Unicode characters) but MariaDB borked when it converted the wchar_t data to cp-1252 (in my case) and then sending it to the MariaDB server that exepected to receive UTF-8 data.