Menu

#76 Parser does not take into account language ID

Win32/Linux
open
nobody
None
5
2015-05-29
2015-05-27
Paul Baker
No

The Lower(), LowerCase(), Upper() and UpperCase() functions and the < <= = > >= comparison operators do not take into account the language ID. The Proper() function is also affected starting in revision 467.

The affected functions are dbfStrUpper(), dbfStrLower(), dbfStrIComp(), dbfStrLIComp(), dbfStrLComp(), dbfStrComp().

These call the StrUpper(), StrLower(), StrIComp(), StrLIComp(), StrLComp() and StrComp() functions in AnsiStrings/SysUtils respectively.

These functions do not have the language ID, so use the current locale.

The StrUpper() and StrLower() functions should take into account the language ID for case conversion.

The StrIComp() and StrLIComp() functions are case insensitive so should take into account the language ID for case comparison.

The StrIComp(), StrLIComp(), StrLComp() and StrComp() should take into account the collation table corresponding to the language ID.

An example of where this matters is when using a greek language driver (eg. 0x6A). Omega with tonos has both a lower case character, ώ, and an upper case character, Ώ. These are represented in the file, using code page 1253, as 0xFE and 0xBF respectively. In English locales, these are not characters that are translated by case conversion, they are untouched (even if they were, they would probably be translated incorrectly).

This should work on both Windows and Linux.

The language ID is available in the parser as Param^.ExpressionContext^.DbfLangId starting in revision 480 in the paulenandrew branch.

Discussion


Log in to post a comment.