The character set used in data sets also plays a role in the storage of character strings. The conzept 16 character set, which was described in article “Der Zeichensatz in CONZEPT 16”, is also used here by default.
If data records are supposed to be stored in the database in a character set other than the conzept 16 character set, there are currently a few things to consider. In this article, I will use the UTF-8 character set as an example. This assumes that the dialog has been saved as a Unicode dialog.
When saving, the character string that is supposed to be set must be converted into the desired target character set. The input field cannot be linked directly to the database field via property wpDbFieldName
for this purpose.
When saving, the content is transferred from the input object to the database field as follows:
// Write character string into the database field
faUniValue # StrCnv(StrCnv($edfaUniValue->wpCaption, _StrToUTF8),
_StrFromANSI);
To display the field content in the input field correctly again, the character string must be converted back in event A, for example. This is done with the following command sequence:
// Write string into input object
$edfaUniValue->wpCaption # StrCnv(StrCnv(faUniValue, _StrToANSI),
_StrFromUTF8);
Similarly, the field in event EvtLstDataInit
can be set as the column content of a RecList.
// Read data set
RecRead(tblUniUnicode, 0, _RecId, aID);
// Convert field from UTF-8
faUniValue # StrCnv(StrCnv(faUniValue, _StrToANSI), _StrFromUTF8);
The content cannot be used from property wpDbFieldName
in label objects either. However, it is sufficient to assign the field content to property wpCaption
of the label.
As the character string is currently not saved as UTF-8, only the first 256 characters of a character set can currently be used. The characters are displayed differently depending on the selected character set.
In future, the procedure will be simplified and Unicode will be supported directly.