OceanBase
English日本語简体中文
Docs Home
Products
Integrations
Release Notes

Databases

OceanBase DatabaseOceanBase Cloud OceanBase Best Practices

Tools

OceanBase Cloud PlatformOceanBase Migration ServiceOceanBase Developer CenterOceanBase Migration AssessmentOceanBase Admin ToolOceanBase Loader and DumperOceanBase DeployerKubernetes operator for OceanBaseOceanBase Diagnostic Tool OceanBase Binlog ServiceOceanBase DataPilot

Connectors and Middleware

OceanBase Database Proxy OceanBase Connector/C OceanBase Connector/J OceanBase Connector/ODBC OceanBase Connector/NETOceanBase Command-Line Client

Databases

OceanBase DatabaseOceanBase Cloud OceanBase Best Practices

Connectors and Middleware

OceanBase Database Proxy OceanBase Connector/C OceanBase Connector/J OceanBase Connector/ODBC OceanBase Connector/NETOceanBase Command-Line Client

Tools

OceanBase Cloud PlatformOceanBase Migration ServiceOceanBase Developer CenterOceanBase Migration AssessmentOceanBase Admin ToolOceanBase Loader and DumperOceanBase DeployerKubernetes operator for OceanBaseOceanBase Diagnostic Tool OceanBase Binlog ServiceOceanBase DataPilot
OceanBase DatabaseOceanBase Cloud ToolsConnectors and MiddlewareLifecycle Support Policy

OceanBase Connector/ODBC

V2.0.7
  • Overview
  • Driver installation and configuration
    • Prepare for the installation
    • Install and configure OceanBase Connector/ODBC for Linux
    • Install and configure the OceanBase Connector/ODBC driver for Windows
  • User guide
    • Basic operations
    • Enable the logging feature
    • Obtain the REF CURSOR data type
  • Reference information
    • OceanBase Connector/ODBC API functions
    • OceanBase Connector/ODBC data types
    • OceanBase Connector/ODBC error codes
  • FAQ
    • Query timeout
    • Chinese garbled characters
  • Release
    • V2.0
      • OceanBase Connector/ODBC V2.0.7
      • OceanBase Connector/ODBC V2.0.6

Download PDF

Document Feedback
  1. Documentation Center
  2. OceanBase Connector/ODBC
  3. V2.0.7

Chinese garbled characters

Last Updated:2026-09-04 08:24:40

What should I do if Chinese garbled characters appear when a Windows-based client is used to call OceanBase Connector/ODBC for queries and GBK is used as the system's default encoding?

What should I do if Chinese garbled characters appear when a Windows-based client is used to call OceanBase Connector/ODBC for queries and GBK is used as the system's default encoding?

The reason is that when OceanBase Connector/ODBC establishes a connection, if no encoding is specified, it will obtain the system's default encoding, that is, MARIADB_CHARSET_INFO *cs= mariadb_get_charset_by_name("auto");

If your system uses UTF-8 encoding for queries, there is no problem. However, if your system uses GBK encoding, UTF-8-encoded data cannot be displayed.

The solution is to add the following code after the connection is established:

/*Set encoding*/
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;

Previous topic

Query timeout
Last

Next topic

OceanBase Connector/ODBC V2.0.7
Next
on this page
What should I do if Chinese garbled characters appear when a Windows-based client is used to call OceanBase Connector/ODBC for queries and GBK is used as the system's default encoding?