Extracting Unicode text from Oracle over ODBC

Ben Rubinstein benr_mc at cogapp.com
Mon Feb 28 12:50:25 EST 2022


I'm trying to extract text from an Oracle database, via ODBC, on Windows. 
(Using the 64 bit "Oracle in instantclient_19_5".)

Generally fine, except that where the text contains Unicode characters beyond 
the Windows Latin1/CP512 character set, I'm not getting them.

I'm not getting random garbage; I'm getting a sensible transliteration, e.g. 
"n" for "ň" (n-caron). So this isn't simply getting the bytes and 
misinterpreting them.

Per 
https://community.oracle.com/tech/apps-infra/discussion/2424496/issue-with-character-set-conversion-using-oracle-odbc-client, 


> The conversion for the ODBC driver is performed by OCI to/from UTF-16 and
> it is independent of the NLS_LANG character set. If the C++ application is
> written in the ANSI mode (does not use wide character data types),
> Microsoft ODBC Manager will convert between the application and the Oracle
> ODBC driver, between system code page (Cp 1252) and UTF-16.

The ODBC driver has a checkbox "Force SQL_WCHAR Support". I've tried both 
settings of this checkbox. Depending on the setting, I have to take a 
different approach to retrieving the data in order not to get garbage (passing 
a variable name to revDatabaseColumnNumbered and then using uniDecode). But 
when I don't get garbage, I also don't get the characters with diacritics - 
but I do get the correct character.

Does anyone have experience of this? Do I need to modify the SQL Select 
statement in some way to get the correct version of the data?

TIA,

Ben




More information about the use-livecode mailing list