Skip to Content
avatar image
Former Member

Need help with ISO8859-X and UTF-8 programming with SAP HANA 2 ODBC client

Hello,

We have trouble to find detailed information about ODBC programming with VARCHAR/NVARCHAR, regarding encodings...

With our solution, we need to allow single-byte (like ISO8859-15) encodings as well as UTF-8 encodings.

So far, we found that the ODBC client encoding can be defined with the "LOCALE" ODBC parameter. However, we don't properly understand the purpose of the SQL_SQLDBC_CHAR_AS_UTF8 connection parameter... has it to be set before or after the connection?

And we need details about the usage of SQL_C_CHAR or SQL_C_WCHAR types when binding SQL parameters or and fetch buffers...

Can SQL_C_CHAR really be UTF-8?

Can we use VARCHAR columns to store ISO8859-X? While it's clear that NVARCHAR are for UNICODE, can VARCHAR columns store ISO8859-x characters?

Is there a programming guide for SAP HANA ODBC client programs?

Thanks!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Sep 06, 2017 at 03:04 PM

    We found the "SAP HANA Client Interface Programming Reference" for SAP HANA Platform 2.0 SPS 02 (Document Version: 1.0 – 2017-07-26). where you can find ODBC parameter descriptions.

    However: The LOCALE ODBC parameter and the SQL_ATTR_CODEPAGE connection parameter do not seem to have any effect when binding with SQL_C_CHAR.

    Only SQL_SQLDBC_CHAR_AS_UTF8 seems to have an effect...

    Anyway, we will go with the Wide Char APIs.

    Seb

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 06, 2017 at 02:58 PM

    After some investigation (with the Linux ODBC client for now), it appears that we can use the Wide-Char APIs (SQLPrepareW), to support both ISO8859-* and UTF-8 encodings in the application, by doing the required codeset conversions (using iconv) from the current application locale to UTF-16LE (and the other way around when fetching data)...

    Note that we DO NOT use unixODBC: We want to link directly with libodbcHDB.so !
    Our solution must have minimal configuration for the customer and we want to save the installation of unixODBC.

    We just need a confirmation.

    See also https://answers.sap.com/questions/300931/what-is-the-internal-encoding-of-nvarchar.html

    Seb

    Add comment
    10|10000 characters needed characters exceeded