localeTest: fix corrupted characters.
This file used to hold iso-8859-15 encoded bytes for testing our char conversion ability. However something went wrong and they all got replaced by unicode "invalid character" mark. Use \x notation to escape the actual bytes we want to test.
This commit is contained in:
@@ -26,19 +26,22 @@ main()
|
|||||||
|
|
||||||
for (int32 i = 30; i < 70; i++) {
|
for (int32 i = 30; i < 70; i++) {
|
||||||
unicode_char_to_string(i, text);
|
unicode_char_to_string(i, text);
|
||||||
printf("%s: alpha == %d, alNum == %d, lower == %d, upper == %d, defined == %d, charType == %d\n",
|
printf("%s: alpha == %d, alNum == %d, lower == %d, upper == %d, "
|
||||||
text,
|
"defined == %d, charType == %d\n", text,
|
||||||
BUnicodeChar::IsAlpha(i), BUnicodeChar::IsAlNum(i), BUnicodeChar::IsLower(i),
|
BUnicodeChar::IsAlpha(i), BUnicodeChar::IsAlNum(i),
|
||||||
BUnicodeChar::IsUpper(i), BUnicodeChar::IsDefined(i), BUnicodeChar::Type(i));
|
BUnicodeChar::IsLower(i), BUnicodeChar::IsUpper(i),
|
||||||
|
BUnicodeChar::IsDefined(i), BUnicodeChar::Type(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 chars[] = {(uint8)'�', (uint8)'�', (uint8)'�', (uint8)'�', (uint8)'�', (uint8)'�', 0};
|
uint32 chars[] = {(uint8)'\xe4', (uint8)'\xd6', (uint8)'\xdf',
|
||||||
|
(uint8)'\xe8', (uint8)'\xe1', (uint8)'\xe9', 0};
|
||||||
for (int32 j = 0, i; (i = chars[j]) != 0; j++) {
|
for (int32 j = 0, i; (i = chars[j]) != 0; j++) {
|
||||||
unicode_char_to_string(i, text);
|
unicode_char_to_string(i, text);
|
||||||
printf("%s: alpha == %d, alNum == %d, lower == %d, upper == %d, defined == %d, charType == %d\n",
|
printf("%s: alpha == %d, alNum == %d, lower == %d, upper == %d, "
|
||||||
text,
|
"defined == %d, charType == %d\n", text,
|
||||||
BUnicodeChar::IsAlpha(i), BUnicodeChar::IsAlNum(i), BUnicodeChar::IsLower(i),
|
BUnicodeChar::IsAlpha(i), BUnicodeChar::IsAlNum(i),
|
||||||
BUnicodeChar::IsUpper(i), BUnicodeChar::IsDefined(i), BUnicodeChar::Type(i));
|
BUnicodeChar::IsLower(i), BUnicodeChar::IsUpper(i),
|
||||||
|
BUnicodeChar::IsDefined(i), BUnicodeChar::Type(i));
|
||||||
|
|
||||||
unicode_char_to_string(BUnicodeChar::ToUpper(i), text);
|
unicode_char_to_string(BUnicodeChar::ToUpper(i), text);
|
||||||
printf("toUpper == %s, ", text);
|
printf("toUpper == %s, ", text);
|
||||||
@@ -50,10 +53,11 @@ main()
|
|||||||
for (int32 j = 0; utf8chars[j] != 0; j++) {
|
for (int32 j = 0; utf8chars[j] != 0; j++) {
|
||||||
int32 i = BUnicodeChar::FromUTF8(utf8chars[j]);
|
int32 i = BUnicodeChar::FromUTF8(utf8chars[j]);
|
||||||
unicode_char_to_string(i, text);
|
unicode_char_to_string(i, text);
|
||||||
printf("%s: alpha == %d, alNum == %d, lower == %d, upper == %d, defined == %d, charType == %d\n",
|
printf("%s: alpha == %d, alNum == %d, lower == %d, upper == %d, "
|
||||||
text,
|
"defined == %d, charType == %d\n", text,
|
||||||
BUnicodeChar::IsAlpha(i), BUnicodeChar::IsAlNum(i), BUnicodeChar::IsLower(i),
|
BUnicodeChar::IsAlpha(i), BUnicodeChar::IsAlNum(i),
|
||||||
BUnicodeChar::IsUpper(i), BUnicodeChar::IsDefined(i), BUnicodeChar::Type(i));
|
BUnicodeChar::IsLower(i), BUnicodeChar::IsUpper(i),
|
||||||
|
BUnicodeChar::IsDefined(i), BUnicodeChar::Type(i));
|
||||||
|
|
||||||
unicode_char_to_string(BUnicodeChar::ToUpper(i), text);
|
unicode_char_to_string(BUnicodeChar::ToUpper(i), text);
|
||||||
printf("toUpper == %s, ", text);
|
printf("toUpper == %s, ", text);
|
||||||
@@ -66,8 +70,8 @@ main()
|
|||||||
|
|
||||||
BCollator collator;
|
BCollator collator;
|
||||||
BLocaleRoster::Default()->GetDefaultLocale()->GetCollator(&collator);
|
BLocaleRoster::Default()->GetDefaultLocale()->GetCollator(&collator);
|
||||||
const char *strings[] = {"gehen", "géhen", "aus", "äUß", "auss", "äUß", "WO",
|
const char *strings[] = {"gehen", "géhen", "aus", "äUß", "auss", "äUß",
|
||||||
"wÖ", "SO", "so", "açñ", "acn", NULL};
|
"WO", "wÖ", "SO", "so", "açñ", "acn", NULL};
|
||||||
const char *strengths[] = {"primary: ", "secondary:", "tertiary: "};
|
const char *strengths[] = {"primary: ", "secondary:", "tertiary: "};
|
||||||
for (int32 i = 0; strings[i]; i += 2) {
|
for (int32 i = 0; strings[i]; i += 2) {
|
||||||
for (int32 strength = B_COLLATE_PRIMARY; strength < 4; strength++) {
|
for (int32 strength = B_COLLATE_PRIMARY; strength < 4; strength++) {
|
||||||
@@ -76,7 +80,8 @@ main()
|
|||||||
collator.GetSortKey(strings[i + 1], &b, strength);
|
collator.GetSortKey(strings[i + 1], &b, strength);
|
||||||
|
|
||||||
printf("%s sort keys: \"%s\" -> \"%s\", \"%s\" -> \"%s\"\n",
|
printf("%s sort keys: \"%s\" -> \"%s\", \"%s\" -> \"%s\"\n",
|
||||||
strengths[strength-1], strings[i], a.String(), strings[i+1], b.String());
|
strengths[strength-1], strings[i], a.String(), strings[i+1],
|
||||||
|
b.String());
|
||||||
printf("\tcmp = %d (key compare = %d)\n",
|
printf("\tcmp = %d (key compare = %d)\n",
|
||||||
collator.Compare(strings[i], strings[i + 1], strength),
|
collator.Compare(strings[i], strings[i + 1], strength),
|
||||||
strcmp(a.String(), b.String()));
|
strcmp(a.String(), b.String()));
|
||||||
|
|||||||
Reference in New Issue
Block a user