DeAnna Davidson wrote:
>OK, maybe I'm a little slow or I missed something.  I've 
>got an app whose .pdbs are made on the PC, and the databases 
>are sorted by a particular field.  The ascii code for a 
>space is 20 and the ascii code for a dash is 2D.  So, logically, 
>if a the same word is in a field followed by a space, I
>put it before the word followed by a dash.  However, I've 
>noticed on the Palm, for instance in the Address Book, if a word 
>is entered followed by a dash and the same word is entered 
>followed by a space, the one with the dash comes before the one 
>with the space.  The bottom line to this is that, of
>course, using StrCaselessCompare or TxtCaselessCompare, a search 
>gets all messed up.  Any insights into why Palm doesn't just 
>use ascii sort order?

OK, I've been through this same issue for the same reasons -- needing to
generate records on the PC in the same sort order that PalmOS uses in the
CaselessCompare functions. The reason they do not use a simple ASCII sort
order is that this would not order the international (accented) characters
correctly. These characters live in the upper ASCII range (>127) and are
somewhat scattered even in that range. The sort order implied by
StrCaselessCompare, using a table instead of binary character value, would,
for example, put "a" followed by "a-accent", "a-umlaut", etc. This was
actually important to me since my application is used for genealogy research
and I have numerous customers in Europe who would like to have their
ancestors' names in the right places. Using a simple ASCII sort, a name
starting with "A-accent" would come after "Z", making it hard to find.

The solution was for me to create my own "PalmStrCompare" function on the PC
side that matched the sort order used by PalmOS. This was one good reason
for having a PalmOS source license! I can now create my database in the
correct alphabetized order. BTW, the PalmOS documentation notes that the
sort order is correct for German and French, but possibly not for some other
countries. However, it is close enough for most purposes.

Drop me a line if you'd like a copy of the routine.

  Doug Gordon
  GHCS Software


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to