At 12:00am -0700 00-10-06, Palm Developer Forum digest wrote:
>Subject: Palm Sort Order
>From: "DeAnna Davidson" <[EMAIL PROTECTED]>
>Date: Thu, 5 Oct 2000 22:23:38 -0400
>X-Message-Number: 83
>
>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?
1. I don't know the historical reasons behind having a dash sort
before a space. Most sort orders (e.g. the default Unicode sort
order) have a dash sorting after a space.
2. ASCII sort order is based on a comparison of raw character code
values. It isn't sufficient for even just US-centric sorting, as
upper & lower-case characters are treated as strongly unequal, as
opposed to weakly equal. It's also only appropriate for 7-bit text,
not high ASCII in the Latin character set. And it definitely wouldn't
work for other character encodings such as Shift-JIS.
3. The sort algorithm used by Palm OS has changed in the past, and
will change again in the future. Which means that the only way to
guarantee that your PDB is sorted correctly is to re-sort it in
response to the post-HotSync launch code. Trying to match the device
sort order on the desktop is a losing proposition.
-- Ken
Ken Krugler
TransPac Software, Inc.
<http://www.transpac.com>
+1 530-470-9200
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/