>Anyhow, I guess I can't use StrNCompare for comparing byte string anymore
>then..

That's correct. Not only does it expect strings, but it expects 
"strings", as in text data, not binary data. Which means that it will 
do all kinds of interesting remapping of your data in an attempt to 
provide locale-specific sorting behavior. That doesn't sound like 
what you want.

>What other functions are available on Palm3.x and Palm4.0 that I can use to
>compare
>two byte strings?

MemCmp()

>I thought TxtCompare is for comparing Multi-byte text?

No, it's for comparing any text that uses the device's character 
encoding. So on an English device, for example, it does the normal 
comparison of Latin-encoded text.

>e.g. If I have a "ABC" in single byte and another string "ABC" in
>,say shit_JIS encoding,

I think the preferred name is Shift-JIS encoding, though some 
programmers might disagree.

>it will return 0 because they represent
>the same text even though the bytes representation are actually
>different.

Actually "ABC" has the same byte representation in both Latin and Shift-JIS.

Also note that the Palm OS handles a single character encoding at 
run-time, thus you couldn't (or shouldn't) pass TxtCompare one string 
encoded with Latin, and another string that's encoded using Shift-JIS.

>This is from the Palm os reference (3.5):
>In certain character encodings (such as Shift JIS), one character may
>be accurately represented as either a single-byte character or a
>multi-byte character. TxtCompare accurately matches a single-byte
>character with its multi-byte equivalent.

So if your app is running on a Japanese device, then TxtCompare will 
correctly handle comparison of characters which are weakly equal but 
differ in the number of bytes required to represent them in the 
string - for example, a single byte 'a' (0x61) and a double-byte 'a' 
(0x8281).

But that doesn't mean it won't work correctly when comparing two 
strings on you English device.

-- 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/

Reply via email to