ICU-8971 fixed parsing inconsistency and corrected few test cases

X-SVN-Rev: 32031
This commit is contained in:
Debabrata Sengupta 2012-07-09 18:25:45 +00:00
parent 6192163b9d
commit f81fa56468
3 changed files with 12 additions and 12 deletions

View File

@ -1700,8 +1700,8 @@ _canonicalize(const char* localeID,
len+=cntrySize; len+=cntrySize;
} }
if(_isIDSeparator(*tmpLocaleID)) { if(_isIDSeparator(*tmpLocaleID)) {
/* If there is something else, then we add the _ if we found country before.*/ /* If there is something else, then we add the _ if we found country before. */
if (cntrySize > 0 ) { if (cntrySize >= 0 && ! _isIDSeparator(*(tmpLocaleID+1)) ) {
++fieldCount; ++fieldCount;
if(len<nameCapacity) { if(len<nameCapacity) {
name[len]='_'; name[len]='_';

View File

@ -398,10 +398,10 @@ static void TestPrefixes() {
{"i-hakka", "", "MX", "", "I-hakka_MX", "i-hakka_MX", NULL}, {"i-hakka", "", "MX", "", "I-hakka_MX", "i-hakka_MX", NULL},
{"x-klingon", "", "US", "SANJOSE", "X-KLINGON_us_SANJOSE", "x-klingon_US_SANJOSE", NULL}, {"x-klingon", "", "US", "SANJOSE", "X-KLINGON_us_SANJOSE", "x-klingon_US_SANJOSE", NULL},
{"zh", "Hans", "", "PINYIN", "zh-Hans-pinyin", "zh_Hans_PINYIN", "zh_Hans@collation=pinyin"}, {"zh", "Hans", "", "PINYIN", "zh-Hans-pinyin", "zh_Hans__PINYIN", "zh_Hans@collation=pinyin"},
{"hy", "", "", "AREVMDA", "hy_AREVMDA", "hy_AREVMDA", NULL}, {"hy", "", "", "AREVMDA", "hy_AREVMDA", "hy__AREVMDA", NULL},
{"de", "", "", "1901", "de-1901", "de_1901", NULL}, {"de", "", "", "1901", "de-1901", "de__1901", NULL},
{"mr", "", "", "", "mr.utf8", "mr.utf8", "mr"}, {"mr", "", "", "", "mr.utf8", "mr.utf8", "mr"},
{"de", "", "TV", "", "de-tv.koi8r", "de_TV.koi8r", "de_TV"}, {"de", "", "TV", "", "de-tv.koi8r", "de_TV.koi8r", "de_TV"},
{"x-piglatin", "", "ML", "", "x-piglatin_ML.MBE", "x-piglatin_ML.MBE", "x-piglatin_ML"}, /* Multibyte English */ {"x-piglatin", "", "ML", "", "x-piglatin_ML.MBE", "x-piglatin_ML.MBE", "x-piglatin_ML"}, /* Multibyte English */
@ -1939,9 +1939,9 @@ static void TestCanonicalization(void)
{ "no@ny", "no@ny", "no__NY" /* not: "nn" [alan ICU3.0] */ }, /* POSIX ID */ { "no@ny", "no@ny", "no__NY" /* not: "nn" [alan ICU3.0] */ }, /* POSIX ID */
{ "no-no.utf32@B", "no_NO.utf32@B", "no_NO_B" /* not: "nb_NO_B" [alan ICU3.0] */ }, /* POSIX ID */ { "no-no.utf32@B", "no_NO.utf32@B", "no_NO_B" /* not: "nb_NO_B" [alan ICU3.0] */ }, /* POSIX ID */
{ "qz-qz@Euro", "qz_QZ@Euro", "qz_QZ@currency=EUR" }, /* qz-qz uses private use iso codes */ { "qz-qz@Euro", "qz_QZ@Euro", "qz_QZ@currency=EUR" }, /* qz-qz uses private use iso codes */
{ "en-BOONT", "en_BOONT", "en_BOONT" }, /* registered name */ { "en-BOONT", "en__BOONT", "en__BOONT" }, /* registered name */
{ "de-1901", "de_1901", "de_1901" }, /* registered name */ { "de-1901", "de__1901", "de__1901" }, /* registered name */
{ "de-1906", "de_1906", "de_1906" }, /* registered name */ { "de-1906", "de__1906", "de__1906" }, /* registered name */
{ "sr-SP-Cyrl", "sr_SP_CYRL", "sr_Cyrl_RS" }, /* .NET name */ { "sr-SP-Cyrl", "sr_SP_CYRL", "sr_Cyrl_RS" }, /* .NET name */
{ "sr-SP-Latn", "sr_SP_LATN", "sr_Latn_RS" }, /* .NET name */ { "sr-SP-Latn", "sr_SP_LATN", "sr_Latn_RS" }, /* .NET name */
{ "sr_YU_CYRILLIC", "sr_YU_CYRILLIC", "sr_Cyrl_RS" }, /* Linux name */ { "sr_YU_CYRILLIC", "sr_YU_CYRILLIC", "sr_Cyrl_RS" }, /* Linux name */

View File

@ -1,6 +1,6 @@
/******************************************************************** /********************************************************************
* COPYRIGHT: * COPYRIGHT:
* Copyright (c) 1997-2011, International Business Machines Corporation and * Copyright (c) 1997-2012, International Business Machines Corporation and
* others. All Rights Reserved. * others. All Rights Reserved.
********************************************************************/ ********************************************************************/
@ -2154,9 +2154,9 @@ void LocaleTest::TestCanonicalization(void)
{ "qz-qz@Euro", "qz_QZ@Euro", "qz_QZ@currency=EUR" }, /* qz-qz uses private use iso codes */ { "qz-qz@Euro", "qz_QZ@Euro", "qz_QZ@currency=EUR" }, /* qz-qz uses private use iso codes */
// NOTE: uloc_getName() works on en-BOONT, but Locale() parser considers it BOGUS // NOTE: uloc_getName() works on en-BOONT, but Locale() parser considers it BOGUS
// TODO: unify this behavior // TODO: unify this behavior
{ "en-BOONT", "en_BOONT", "en_BOONT" }, /* registered name */ { "en-BOONT", "en__BOONT", "en__BOONT" }, /* registered name */
{ "de-1901", "de_1901", "de_1901" }, /* registered name */ { "de-1901", "de__1901", "de__1901" }, /* registered name */
{ "de-1906", "de_1906", "de_1906" }, /* registered name */ { "de-1906", "de__1906", "de__1906" }, /* registered name */
{ "sr-SP-Cyrl", "sr_SP_CYRL", "sr_Cyrl_RS" }, /* .NET name */ { "sr-SP-Cyrl", "sr_SP_CYRL", "sr_Cyrl_RS" }, /* .NET name */
{ "sr-SP-Latn", "sr_SP_LATN", "sr_Latn_RS" }, /* .NET name */ { "sr-SP-Latn", "sr_SP_LATN", "sr_Latn_RS" }, /* .NET name */
{ "sr_YU_CYRILLIC", "sr_YU_CYRILLIC", "sr_Cyrl_RS" }, /* Linux name */ { "sr_YU_CYRILLIC", "sr_YU_CYRILLIC", "sr_Cyrl_RS" }, /* Linux name */