mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-10 15:42:14 +00:00
ICU-21408 Prohibit alpha4 as language inside tlang.
This commit is contained in:
parent
275d59aa2a
commit
0ab995ec84
2 changed files with 8 additions and 2 deletions
|
@ -670,9 +670,13 @@ _isTransformedExtensionSubtag(int32_t& state, const char* s, int32_t len)
|
|||
const int32_t kGotTKey = -1; // Got tkey, wait for tvalue. ERROR if stop here.
|
||||
const int32_t kGotTValue = 6; // Got tvalue, wait for tkey, tvalue or end
|
||||
|
||||
|
||||
if (len < 0) {
|
||||
len = (int32_t)uprv_strlen(s);
|
||||
}
|
||||
switch (state) {
|
||||
case kStart:
|
||||
if (ultag_isLanguageSubtag(s, len)) {
|
||||
if (ultag_isLanguageSubtag(s, len) && len != 4) {
|
||||
state = kGotLanguage;
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -1375,7 +1375,7 @@ void LocaleBuilderTest::TestSetExtensionValidateTIllFormed() {
|
|||
"9-",
|
||||
"-9",
|
||||
"-z",
|
||||
// "Latn", // Per 2019-01-23 ICUTC, still accept 4alpha. See ICU-20321
|
||||
"Latn",
|
||||
"Latn-",
|
||||
"en-",
|
||||
"nob-",
|
||||
|
@ -1400,6 +1400,8 @@ void LocaleBuilderTest::TestSetExtensionValidateTIllFormed() {
|
|||
"gab-Thai-TH-0bde-z9-abcde123-a1-",
|
||||
"gab-Thai-TH-0bde-z9-abcde123-a1-a",
|
||||
"gab-Thai-TH-0bde-z9-abcde123-a1-ab",
|
||||
// ICU-21408
|
||||
"root",
|
||||
};
|
||||
for (const char* ill : illFormed) {
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
|
|
Loading…
Add table
Reference in a new issue