[Lazarus] UTF8 string compare with correct locale sorting

Jürgen Hestermann juergen.hestermann at gmx.de
Fri Oct 18 07:22:08 CEST 2013


Am 2013-10-17 21:56, schrieb Hans-Peter Diettrich:
 > Jürgen Hestermann schrieb:
 >> But it does not obey sorting by locale (i.e. german umlauts end
 >> up at the end of the list although they need to be sorted together with
 >> their corresponding non-umlaut  characters (Ü at U, Ä at A, and so on).
 >>
 >> Does *any* Pascal UTF8 string compare function exist that does this?
 >
 > Such functions should be provided by the system's Unicode/internationalization library. When they can be located there, a wrapper can be added to the RTL.

Yes, it exists. But on Windows for example is not available for UTF8, only for UTF16. When I store millions of file names I already have the problem to convert from UTF16 to UTF8 and now I need to convert back again only to get a correct sorting? That would be a real performance hit. It's strange that so many UTF8 string functions exist but none that sorts correctly dependend on locale.





More information about the Lazarus mailing list