Recent

Author Topic: Displaying UTF-8 fields in DBGrid from IBM Informix DB via ODBC driver  (Read 2247 times)

Vodnik

  • Full Member
  • ***
  • Posts: 210
Hello!
My project is an exact copy of SQLdb_Tutorial1, described here: https://wiki.freepascal.org/SQLdb_Tutorial1, attached Test.7z.
I connect to IBM Informix DB via ODBC driver that have following default settings (see ODBC.PNG):
Client Locale=en_US.1252
Database Locale=en_US.819
If the DB field contain string in UTF-8 format (supposedly), then my application produce series of errors (see err1-3.png) and skip the row in DBGrid display (see tables.png, top). The same data can be displayed with WinSQL (see tables.png, bottom).
Playing around, I have set Client Locale=en_US.UTF8 in ODBC driver and this have cleared an exception. Though the string was not displayed correctly (table.png, will attach in next message).
Changing Database Locale in ODBC driver to anything different from en_US.819 (that is English CP) causes informix error "locale mismatch". Likely DB is in English locale while containing some UTF-8 strings.
I have set ODBCConnection1.CharSet=UTF8.
So questions:
1. I hope that there should be means in Lazarus to not produce exception on reading UTF-8 string from DB, even in case of poor ODBC driver settings (as WinSQL do).
2. Any idea how to display UTF-8 string in DBGrid correctly.

Vodnik

  • Full Member
  • ***
  • Posts: 210
Re: Displaying UTF-8 fields in DBGrid from IBM Informix DB via ODBC driver
« Reply #1 on: October 23, 2019, 02:49:39 pm »
DBGrid display in case of Client Locale: en_US:UTF8
┼ sign is used as separator between name and first name
Setting Client Locale in ODBC to ru_RU:UTF8 causes another informix error (err4.png) "Unable to load locale categories"
« Last Edit: October 23, 2019, 03:13:38 pm by Vodnik »

 

TinyPortal © 2005-2018