skip to main content
Internationalization, localization, and Unicode : Character encoding in the odbc.ini and odbcinst.ini files
  

Try DataDirect Drivers Now

Character encoding in the odbc.ini and odbcinst.ini files

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
Unicode (wide or "W") functions:
*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.
When a Unicode function is called, the Driver Manager assumes that the odbc.ini and odbcinst.ini files use UTF-8 encoding, while encoding for the application is determined by the ODBC_App_Unicode_Type variable in the system environment:
*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.