diff --git a/icu4c/source/i18n/olsontz.cpp b/icu4c/source/i18n/olsontz.cpp index b69e76e640e..184549f7f6a 100644 --- a/icu4c/source/i18n/olsontz.cpp +++ b/icu4c/source/i18n/olsontz.cpp @@ -616,8 +616,10 @@ OlsonTimeZone::initTransitionRules(UErrorCode& status) { UnicodeString tzid; getID(tzid); - UnicodeString stdName = tzid + "(STD)"; - UnicodeString dstName = tzid + "(DST)"; + UnicodeString _std("(STD)", -1, US_INV); + UnicodeString _dst("(DST)", -1, US_INV); + UnicodeString stdName = tzid + _std; + UnicodeString dstName = tzid + _dst; int32_t raw, dst; if (transitionCount > 0) { diff --git a/icu4c/source/i18n/simpletz.cpp b/icu4c/source/i18n/simpletz.cpp index ef4cdd06b2b..ff7cd8f3d87 100644 --- a/icu4c/source/i18n/simpletz.cpp +++ b/icu4c/source/i18n/simpletz.cpp @@ -1021,6 +1021,8 @@ SimpleTimeZone::initTransitionRules(UErrorCode& status) { DateTimeRule* dtRule; DateTimeRule::TimeRuleType timeRuleType; UDate firstStdStart, firstDstStart; + UnicodeString dst("(DST)", -1, US_INV); // These work even if + UnicodeString std("(STD)", -1, US_INV); // UCONFIG_NO_CONVERSION is set. // Create a TimeZoneRule for daylight saving time timeRuleType = (startTimeMode == STANDARD_TIME) ? DateTimeRule::STANDARD_TIME : @@ -1043,7 +1045,7 @@ SimpleTimeZone::initTransitionRules(UErrorCode& status) { return; } // For now, use ID + "(DST)" as the name - dstRule = new AnnualTimeZoneRule(tzid+"(DST)", getRawOffset(), getDSTSavings(), + dstRule = new AnnualTimeZoneRule(tzid+dst, getRawOffset(), getDSTSavings(), dtRule, startYear, AnnualTimeZoneRule::MAX_YEAR); // Calculate the first DST start time @@ -1067,7 +1069,7 @@ SimpleTimeZone::initTransitionRules(UErrorCode& status) { break; } // For now, use ID + "(STD)" as the name - stdRule = new AnnualTimeZoneRule(tzid+"(STD)", getRawOffset(), 0, + stdRule = new AnnualTimeZoneRule(tzid+std, getRawOffset(), 0, dtRule, startYear, AnnualTimeZoneRule::MAX_YEAR); // Calculate the first STD start time @@ -1075,10 +1077,10 @@ SimpleTimeZone::initTransitionRules(UErrorCode& status) { // Create a TimeZoneRule for initial time if (firstStdStart < firstDstStart) { - initialRule = new InitialTimeZoneRule(tzid+"(DST)", getRawOffset(), dstRule->getDSTSavings()); + initialRule = new InitialTimeZoneRule(tzid+dst, getRawOffset(), dstRule->getDSTSavings()); firstTransition = new TimeZoneTransition(firstStdStart, *initialRule, *stdRule); } else { - initialRule = new InitialTimeZoneRule(tzid+"(STD)", getRawOffset(), 0); + initialRule = new InitialTimeZoneRule(tzid+std, getRawOffset(), 0); firstTransition = new TimeZoneTransition(firstDstStart, *initialRule, *dstRule); } diff --git a/icu4c/source/i18n/smpdtfmt.cpp b/icu4c/source/i18n/smpdtfmt.cpp index 67ca7b40877..b21b08edbca 100644 --- a/icu4c/source/i18n/smpdtfmt.cpp +++ b/icu4c/source/i18n/smpdtfmt.cpp @@ -950,7 +950,7 @@ SimpleDateFormat::zoneIDCanonicalize(UnicodeString &zid) const int32_t len; const UChar* alias = ures_getNextString(zoneAliases,&len,NULL,&status); if ( zid.compare(alias)==0 ) { - zid.setTo(UnicodeString(currentZoneString,(const char *)0)); + zid.setTo(UnicodeString(currentZoneString, -1, US_INV)); zid.findAndReplace(colon,solidus); ures_close(zoneAliases); ures_close(currentZone);