Character encoding in the odbc.ini and odbcinst.ini files
- Last Updated: October 2, 2020
- 2 minute read
- DataDirect Connectors
- ODBC
- Aha! 8.0
- Amazon Redshift 8.0
- Apache Cassandra 8.0
- Apache Hive 8.0
- Apache Spark SQL 8.0
- Autonomous Rest Connector 8.0
- Cloudera Impala 7.1
- dBase 7.1
- + 24
![]()
The odbc.ini and odbcinst.ini files can use ANSI or UTF-8 encoding. To ensure encoding compatibility between these files and the application, the Driver Manager converts encoding when necessary. This allows applications with different encoding to write to or read from the odbc.ini or odbcinst.ini file using the following functions:
ANSI functions:
- SQLWritePrivateProfileString
- SQLGetPrivateProfileString
- SQLWritePrivateProfileStringW
- SQLGetPrivateProfileStringW
For the Driver Manager to accomplish this task, it must determine the encoding format your application and file use. How the Driver Manager makes this determination is dependent on the encoding of the function called by the application.
- If the variable is set to
ODBC_App_Unicode_Type=1, the Driver Manager expects that application uses input and output strings encoded as UTF-16. When the application calls SQLWritePrivateProfileStringW, the Driver Manager converts UTF-16 input strings and writes them as UTF-8 in the file. When the application calls SQLGetPrivateProfileStringW, the Driver Manager returns the requested values using UTF-16 encoding. - If any other value is specified for ODBC_App_Unicode_Type, or if the variable is not defined, the Driver Manager assumes that the application and file use UTF-8. When this occurs, the Driver Manager does not convert strings passed between the application and file.
When an ANSI function is called, the Driver Manager assumes that application and file use ANSI encoding. In this scenario, the Driver Manger does not convert strings passed between the application and file.
For more information about the odbc.ini and odbcinst.ini files, refer to "Configuring the Product on UNIX/Linux" in the user's guide for you driver.