Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

which is the correct text comparison method for an international application...AnsiCompareText or CompareText?

I'm using Delphi 2009 to write an app that uses an Access database.

I noticed that MS Access' ORDER BY seems to be sorting international character sets like AnsiCompareText whereas throughout my app, I'm using SysUtils.CompareText.

Access' (Jet's) ORDER BY results (delphi AnsiCompareText( ) is the same)
  Nørmork
  Öster
  RAM

delphi CompareText( )
  Nørmork
  RAM
  Öster

Which is the correct call i should be using for a comparison?

Note: I am using USA English as my locale.

Sorry, I don't know so much about this. There are many web sites that discuss related topics at length but I haven't seen a discussion about which is most appropriate.

Thank you!

like image 575
X-Ray Avatar asked Dec 07 '25 10:12

X-Ray


1 Answers

CompareText does an ASCII comparision while AnsiCompareText uses the ANSI codepage (or in Delphi 2009+ the unicode table) to compare characters. So CompareText only works if you have plain English text.

like image 74
Andreas Hausladen Avatar answered Dec 10 '25 16:12

Andreas Hausladen