EVG Martens GmbH & Co. KG
Original Message:
Sent: Mon April 28, 2025 10:27 AM
From: Sebastien FLAESCH
Subject: future support of UTF-8 character handling
Roland,
Basically agreed.
I assume/hope HCL Informix team has some ideas and resources for that.
The big part of the work is internal stuff I guess (storage, char string functions, etc).
To me support for UTF-8 is a complete migration of the whole database / tables.
So instead an environment variable or new SQL option at the table or column level, I would rather expect a global onconfig parameter (for all databases created by the server), or an option when creating the database with CREATE DATABASE ... WITH LENGTH_SEMANTICS=CHAR/BYTE ( to be used with DB_LOCALE/CLIENT_LOCALE = *.utf8 )
Then dbexport from the ISO-8859-15 database, and dbimport into a new UTF-8 database.
I really doubt someone can manage to have mix of SBCS and UTF-8 in the same DB, with the same client application accessing both kind of char string data.
If it's based on an env var, as you suggest, then it must work just like when using DB_LOCALE defining the db locale at CREATE DATABASE time.
Then, if you use a different setting when connection to the database, Informix should give an error like when using a wrong DB_LOCALE.
Seb
------------------------------
Sebastien FLAESCH
------------------------------
Original Message:
Sent: Mon April 28, 2025 09:05 AM
From: Roland Wintgen
Subject: future support of UTF-8 character handling
Sebastien,
I'm already familiar with the meaning of SQL_LOGICAL_CHAR, but I think this was more of a workaround to get around the real problem, which is the handling of multibyte characters. I can imagine that the support of multi-byte characters is not trivial and the implementation should also be properly done. I completely agree with you.
So maybe it would be better to introduce an environment variable SQL_CHAR_SEMANTICS (according to https://4js.com/online_documentation/fjs-fgl-manual-html/#fgl-topics/c_fgl_localization_022.html) instead of an optional parameter BYTE or CHAR for a CHAR data type, which is used when creating a new database to specify how strings should be handled. This would at least prevent there being several columns within a table that would differ in the handling of single or multibyte characters.
Kind regards
------------------------------
Roland Wintgen
DBA, Genero/4GL Developer
EVG Martens GmbH & Co. KG
Moenchengladbach
Original Message:
Sent: Mon April 28, 2025 08:01 AM
From: Sebastien FLAESCH
Subject: future support of UTF-8 character handling
Hi Roland,
I am maybe missing some details but from my knowledge, SQL_LOGICAL_CHAR is basically a ratio that applies to define the size of CHAR/VARCHAR columns when creating an SQL table.
So when you have SQL_LOGICAL_CHAR=3, it's as if you would do it by yourself, by converting
CREATE TABLE tab ( ... column_xyz VARCHAR(50) ... )
to:
CREATE TABLE tab ( ... column_xyz VARCHAR(150) ... ) -- 50 x 3 = 150 bytes
But all length semantics are still based on byte units...
So SQL_LOGICAL_CHAR is rather just a helper to get enough bytes to store your UTF-8 strings.
Implementing complete support for char length semantics is quite some work!!!
I prefer that Informix team takes the time to do that properly...
About mixing length semantics and character sets, imagine you have a single table with 2 columns, using different length semantics and charsets.
If you fetch your data into a program variable, the language you use must also support the distinction of length semantics and charset AT THE VARIABLE level... ready for that?
BTW, see also:
https://4js.com/online_documentation/fjs-fgl-manual-html/#fgl-topics/c_fgl_odiagifx_003.html
Seb
------------------------------
Sebastien FLAESCH
Original Message:
Sent: Mon April 28, 2025 07:36 AM
From: Roland Wintgen
Subject: future support of UTF-8 character handling
Sebastien,
thank you for you thoughts.
I already upvoted the RFE, but I doubt that it will be implemented again at some point, even if the status is "future consideration".
The best solution would of course be if Informix would adapt the CHAR data type, so that it would generally only support multibyte characters and you would therefore no longer have to worry about how many bytes a character consists of.
I have no idea why this was not done and instead the workaround via SQL_LOGICAL_CHAR was taken. Maybe they wanted to offload the problem onto the database developer instead of solving the problem right away?
Perhaps I didn't understand your comment correctly. You say that introducing a new data type for multibyte characters would not be a good idea. On the other hand, you don't want to mix single and multibyte characters because that would lead to problems in application development. But wouldn't this mixing be the case if it would depend on whether CHAR columns could be defined as either a single or multibyte character, as described in my proposal?
Do you think there is a better solution?
Kind regards
------------------------------
Roland Wintgen
DBA, Genero/4GL Developer
EVG Martens GmbH & Co. KG
Moenchengladbach
Original Message:
Sent: Mon April 28, 2025 06:20 AM
From: Sebastien FLAESCH
Subject: future support of UTF-8 character handling
Hello Roland,
+1
I have already suggested this to IBM/HCL a while ago, and someone reported this idea a decade ago:
https://ibm-data-and-ai.ideas.ibm.com/ideas/INFX-I-190
https://ideas.ibm.com/search?query=INFX-I-190
The concept you are looking for is called "byte/char length semantics", to define in which unit a length is expressed, either in a CHAR/VARCHAR size, in subscripts ( col[5,8] ) or functions such as LENGTH(expr)
With other SQL engines, you can define the byte or char(acter) length semantics at various levels (server, database, session, column) - as you discovered with O..
When defined at a global level (session, database), it applies when you create a table with a VARCHAR(50) without specifying any BYTE/CHAR clause.
Some SQL engines ONLY support char length semantics.
To me, introducing new character data types is not a good idea:
You don't want to mix byte-length and char-length semantics: It's a nightmare with application code.
Migrating from a Single Byte Character Set like ISO-8859-15 to UTF-8 should be done for the whole database (all CHAR/VARCHAR columns).
Migration must include application code to handle UTF-8 and the concept of byte/char length semantics.
C-based programs use C lib functions to manage UTF-8 character strings, based on LANG/LC_ALL/locale settings.
If you want more details you have see how to support this with Genero BDL:
https://4js.com/online_documentation/fjs-fgl-manual-html/#fgl-topics/c_fgl_localization_038.html
Seb
------------------------------
Sebastien FLAESCH