mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-13 00:43:32 +00:00
ICU-13374 Fixed localized GMT offset format roundtrip in Perisian locale.
X-SVN-Rev: 40493
This commit is contained in:
parent
131f416755
commit
1599dabb7c
3 changed files with 26 additions and 5 deletions
icu4c/source
icu4j/main/tests/core/src/com/ibm/icu/dev/test/format
|
@ -18,6 +18,7 @@
|
|||
#include "unicode/uchar.h"
|
||||
#include "unicode/udat.h"
|
||||
#include "unicode/ustring.h"
|
||||
#include "unicode/utf16.h"
|
||||
#include "tzgnames.h"
|
||||
#include "cmemory.h"
|
||||
#include "cstring.h"
|
||||
|
@ -30,6 +31,7 @@
|
|||
#include "uvector.h"
|
||||
#include "zonemeta.h"
|
||||
#include "tznames_impl.h" // TextTrieMap
|
||||
#include "patternprops.h"
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
|
||||
|
@ -1862,6 +1864,27 @@ TimeZoneFormat::parseOffsetFieldsWithPattern(const UnicodeString& text, int32_t
|
|||
if (fieldType == GMTOffsetField::TEXT) {
|
||||
const UChar* patStr = field->getPatternText();
|
||||
len = u_strlen(patStr);
|
||||
if (i == 0) {
|
||||
// When TimeZoneFormat parse() is called from SimpleDateFormat,
|
||||
// leading space characters might be truncated. If the first pattern text
|
||||
// starts with such character (e.g. Bidi control), then we need to
|
||||
// skip the leading space charcters.
|
||||
if (!PatternProps::isWhiteSpace(text.char32At(idx))) {
|
||||
for (;;) {
|
||||
UChar32 ch;
|
||||
int32_t chLen;
|
||||
U16_GET(patStr, 0, 0, len, ch)
|
||||
if (PatternProps::isWhiteSpace(ch)) {
|
||||
chLen = U16_LENGTH(ch);
|
||||
len -= chLen;
|
||||
patStr += chLen;
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (text.caseCompare(idx, len, patStr, 0) != 0) {
|
||||
failed = TRUE;
|
||||
break;
|
||||
|
|
|
@ -140,7 +140,8 @@ TimeZoneFormatTest::TestTimeZoneRoundTrip(void) {
|
|||
Locale("en"),
|
||||
Locale("en_CA"),
|
||||
Locale("fr"),
|
||||
Locale("zh_Hant")
|
||||
Locale("zh_Hant"),
|
||||
Locale("fa")
|
||||
};
|
||||
|
||||
const Locale *LOCALES;
|
||||
|
@ -162,9 +163,6 @@ TimeZoneFormatTest::TestTimeZoneRoundTrip(void) {
|
|||
if (uprv_strcmp(LOCALES[locidx].getLanguage(),"ccp")==0 && logKnownIssue("13366", "Skip handling ccp until TimeZone offset roundtrip is fixed")) {
|
||||
continue;
|
||||
}
|
||||
if (uprv_strcmp(LOCALES[locidx].getLanguage(),"fa")==0 && logKnownIssue("13374", "Skip handling fa until TimeZone offset roundtrip is fixed")) {
|
||||
continue;
|
||||
}
|
||||
UnicodeString localGMTString;
|
||||
SimpleDateFormat gmtFmt(UnicodeString("ZZZZ"), LOCALES[locidx], status);
|
||||
if (U_FAILURE(status)) {
|
||||
|
|
|
@ -128,7 +128,7 @@ public class TimeZoneFormatTest extends TestFmwk {
|
|||
if (TEST_ALL || TestFmwk.getExhaustiveness() > 5) {
|
||||
LOCALES = ULocale.getAvailableLocales();
|
||||
} else {
|
||||
LOCALES = new ULocale[] {new ULocale("en"), new ULocale("en_CA"), new ULocale("fr"), new ULocale("zh_Hant")};
|
||||
LOCALES = new ULocale[] {new ULocale("en"), new ULocale("en_CA"), new ULocale("fr"), new ULocale("zh_Hant"), new ULocale("fa")};
|
||||
}
|
||||
|
||||
String[] tzids;
|
||||
|
|
Loading…
Add table
Reference in a new issue