Mac OS 9 Lives

Mac OS 9 Discussion => Development & Programming => Topic started by: OS923 on March 23, 2021, 10:52:03 AM

Title: Unicode collation
Post by: OS923 on March 23, 2021, 10:52:03 AM
Why does this return -50?

Code: [Select]
UCCollateOptions options=kUCCollateStandardOptions;
const UniChar text1='a';
const UniChar text2='b';
Boolean equivalent;
SInt32 order;
OSStatus status=::UCCompareTextNoLocale(options,
                                        &text1,
                                        1,
                                        &text2,
                                        1,
                                        &equivalent,
                                        &order);
Title: Re: Unicode collation
Post by: teroyk on March 24, 2021, 08:34:37 AM
Why does this return -50?
Code: [Select]
UCCollateOptions options=kUCCollateStandardOptions;
const UniChar text1='a';

Good question, I am not that far in unicode programming, but how we should define text1 when Unicode in Mac OS 9 is UTF-16BE = one char is 2 bytes?
btw. does OS 9 support only Unicode characters U+0000...U+FFFF and not characters that takes 4 bytes in UTF-16 (U+10000...U+10FFFF)  UTF-16 does not have 3 byte coding.
Title: Re: Unicode collation
Post by: OS923 on March 29, 2021, 08:59:27 AM
This function is for Unicode, not UTF.