summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFredrik Roubert <roubert@google.com>2017-04-27 14:50:31 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-04-27 14:50:31 +0000
commit6ac2206752402b77d06253189410f544bfdf0c9f (patch)
treea0a7826731e6cb474e0c46e534f128e0b1896402
parentfdc83dca47c40c94130894ed5eb355cb62a8a95d (diff)
parent1a71587d9fc6b1d3421b101ae876d01760d006b1 (diff)
downloadicu-6ac2206752402b77d06253189410f544bfdf0c9f.tar.gz
Cherry-pick: ticket:13094: Handle empty language subtag in parseTagString(). am: c0d7fcce31 am: b2e7f9df3e
am: 1a71587d9f Change-Id: I49eeeb4e042c11f6478dce164fca345152037c42
-rw-r--r--icu4c/source/common/loclikely.cpp2
-rw-r--r--icu4c/source/test/cintltst/cloctst.c20
2 files changed, 21 insertions, 1 deletions
diff --git a/icu4c/source/common/loclikely.cpp b/icu4c/source/common/loclikely.cpp
index c13b37e1a..9b378a57a 100644
--- a/icu4c/source/common/loclikely.cpp
+++ b/icu4c/source/common/loclikely.cpp
@@ -510,7 +510,7 @@ parseTagString(
unknownLanguage);
*langLength = (int32_t)uprv_strlen(lang);
}
- else if (_isIDSeparator(*position)) {
+ if (_isIDSeparator(*position)) {
++position;
}
diff --git a/icu4c/source/test/cintltst/cloctst.c b/icu4c/source/test/cintltst/cloctst.c
index c9c0ec90e..bd82c892a 100644
--- a/icu4c/source/test/cintltst/cloctst.c
+++ b/icu4c/source/test/cintltst/cloctst.c
@@ -3400,6 +3400,21 @@ const char* const basic_maximize_data[][2] = {
}, {
"de_Latn_DE_u_co_phonebk",
"de_Latn_DE_U_CO_PHONEBK"
+ }, {
+ "_Arab@em=emoji",
+ "ar_Arab_EG@em=emoji"
+ }, {
+ "_Latn@em=emoji",
+ "en_Latn_US@em=emoji"
+ }, {
+ "_Latn_DE@em=emoji",
+ "de_Latn_DE@em=emoji"
+ }, {
+ "_Zzzz_DE@em=emoji",
+ "de_Latn_DE@em=emoji"
+ }, {
+ "_DE@em=emoji",
+ "de_Latn_DE@em=emoji"
}
};
@@ -5948,6 +5963,11 @@ static const struct {
{"en-u-baz-ca-islamic-civil", "en@attribute=baz;calendar=islamic-civil", FULL_LENGTH},
{"en-a-bar-u-ca-islamic-civil-x-u-foo", "en@a=bar;calendar=islamic-civil;x=u-foo", FULL_LENGTH},
{"en-a-bar-u-baz-ca-islamic-civil-x-u-foo", "en@a=bar;attribute=baz;calendar=islamic-civil;x=u-foo", FULL_LENGTH},
+ {"und-Arab-u-em-emoji", "_Arab@em=emoji", FULL_LENGTH},
+ {"und-Latn-u-em-emoji", "_Latn@em=emoji", FULL_LENGTH},
+ {"und-Latn-DE-u-em-emoji", "_Latn_DE@em=emoji", FULL_LENGTH},
+ {"und-Zzzz-DE-u-em-emoji", "_Zzzz_DE@em=emoji", FULL_LENGTH},
+ {"und-DE-u-em-emoji", "_DE@em=emoji", FULL_LENGTH},
{NULL, NULL, 0}
};