To continue with this content, please log in with your Data Access ID or create a new account.
Cancel Data Access ID
You may not be authorized to see this content. Please contact Data Access Europe for more information.
Cancel Data Access Europe
You are not authorized to see this content.
Cancel Data Access Europe
Next lesson:
Collation
Cancel

Migrating to DataFlex 2021 Part 2

Lesson 10: Unicode in databases

As previously mentioned in the course, the embedded database does not support Unicode, and data written to it is converted to OEM by the runtime, through a compatibility layer. It is backwards compatible, and the database can be shared with older revisions of DataFlex. The sorting of the indexes is done according to the Df_collate.cfg in bin or bin64. Note that string comparisons in the language are now performed using the new Unicode comparisons, and can be different than the embedded database collation.

Having said that, it is recommended to use SQL databases, where MS SQL is the recommended backend. To work with Unicode on MS SQL, use the ‘NChar’ and ‘NvarChar’ data types, instead of ‘Char’ and ‘Varchar,’ which you can set from the table editor in the Studio.

Data is stored as UTF-16, and the SQL drivers will perform the necessary conversions for you. If df_table_character_format is set to OEM, it is recommended to convert existing SQL data from OEM to ANSI before converting to Unicode data types. Note that if the df_table_character_format attribute in the existing SQL tables is set to OEM, the data will be stored as OEM in the database. When converting fields to ‘NChar’ or ‘NVarChar’ the automatic conversion of the data by MS SQL will likely fail as it interprets the data as ANSI. It is recommended to convert the existing SQL data from OEM to ANSI before converting to Unicode data types. 

The connectivity kits support Unicode for a number of databases as shown here. Note that the UTF-8 support on SQL Server 2019 is supported, but that, even then, ‘NChar’ and ‘NVarChar’ are recommended due to the field size interpretation. MySQL is Unicode supported. Use the character set utf8mb4 on fields. For DB2, use codeset UTF-8 on the database. Legacy drivers are still supported, but data is converted to OEM, using a compatibility layer, so they are not Unicode. This is also true for Btrieve / Pervasive, however, it is being investigated to support Unicode.