Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2009
    Posts
    3

    Unanswered: Extra conversion to UTF-8 via ODBC

    I have DB2 v8.1.17.789 on Windows. I inherited a MFC non-Unicode multilingual application that connects to UTF-8 database (codeset UTF-8, territory SI, Slovenia). Strings that are sent through ODBC are UTF-8 strings (non-orthodox approach, but at this time I can't turn my application to Unicode).

    In DB2 Control Center I see strings as "raw", garbled if characters are outside ASCII range. This is because the string is converted between my app and database (probably by ODBC driver) from system code page to UTF-8.

    Is there a way to prevent this conversion? I would like to have nice strings in database, and to be able to accurately verify lengths before I send strings to database.

    I'm not versed to DB2, but I suspect there might be some setting on ODBC part, or DB2 part, with which this can easily be accomplished. All I want is to make DB2 realize it already gets UTF-8 string, no need to convert them.

  2. #2
    Join Date
    Nov 2009
    Location
    Bangalore
    Posts
    25
    Last edited by sawangupta; 11-23-09 at 23:23. Reason: Link corrected

  3. #3
    Join Date
    Nov 2009
    Posts
    3
    I have set the DB2CODEPAGE environment variable to 1208 (System Properties > Advanced > Environment Variables), and restarted my applications, but nothing has changed, the strings are still garbled. One remark: even though the CODESET is set to UTF-8 in the database, the CODEPAGE value is empty.

  4. #4
    Join Date
    Nov 2009
    Posts
    3
    Problem solved. Instead of environment variable I had to use "db2set DB2CODEPAGE=1208". I guess this is because the database is on the same computer as the application.

    Sawangupta, thank you for your response, it was helpful. BTW, your first link is broken.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •