Chinese garbled characters are generated when I use a Windows-based client to call OceanBase Connector/ODBC to query data and use GBK as the default character set of my system. What should I do?
The cause is that if you do not specify a character set when you establish a connection by using OceanBase Connector/ODBC, the default system character set UTF8 is used. MARIADB_CHARSET_INFO *cs= mariadb_get_charset_by_name("auto");
If your system uses UTF8, you can query data normally. If your system uses GBK, UTF8-encoded data cannot be displayed. To solve this problem, add code to specify the character set of the data to be read after you establish a connection. Example:
/*Specify the character set.*/
MDBUG_C_PRINT(Connection, "--cs_name:%s", Connection->Charset.cs_info->csname);
if (mysql_set_character_set(Connection->mariadb, Connection->Charset.cs_info->csname))
goto err;