From: Peter Edberg
Date: Mon, 7 Sep 2015 22:39:49 +0000 (+0000)
Subject: ICU-11773 Withdraw COLON as pattern char, leave support for UDAT_TIME_SEPARATOR_FIELD (C)
X-Git-Tag: milestone-59-0-1~921
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=49d4ab5ee65ef154139902cd94edd88aaf522ec7;p=icu
ICU-11773 Withdraw COLON as pattern char, leave support for UDAT_TIME_SEPARATOR_FIELD (C)
X-SVN-Rev: 37898
---
diff --git a/icu4c/readme.html b/icu4c/readme.html
index 2567eb4d7a4..ae8b1efb019 100644
--- a/icu4c/readme.html
+++ b/icu4c/readme.html
@@ -21,9 +21,9 @@
milestone - if the release note is a milestone release
-->
-
-
-
+
+
+
Note: This is a draft readme.
@@ -31,7 +31,7 @@
International Components for Unicode
Release Candidate
(Milestone Release)
- ICU 56m1 ReadMe
+ ICU 56 ReadMe
@@ -43,7 +43,7 @@
This is a release candidate version of ICU4C.
It is not recommended for production use.
- Last updated: 2015-Jul-16
+
Last updated: 2015-Sep-07
Copyright © 1997-2015 International Business Machines Corporation and
others. All Rights Reserved.
@@ -237,14 +237,26 @@
list of APIs added, removed, or changed in this release.
+ COLON withdrawn as date/time pattern character
+ In ICU 55, COLON was introduced as a date/time pattern character
+ to be replaced by the value of the timeSeparator for the number
+ system being used; a corresponding new UDateFormatField
+ UDAT_TIME_SEPARATOR_FIELD was added. Use of COLON caused some
+ backwards compatibility problems, so it is being withdrawn as a
+ pattern character. However, UDAT_TIME_SEPARATOR_FIELD remains
+ as does the mechanism for replacing a pattern character with the
+ value of the timeSeparator; a new pattern character may be
+ assigned in the future.
+
ICU Plugins: disabled by default
ICU Plugins are now disabled by default. They may be enabled
with the configure option
--enable-plugins or by means of
#define UCONFIG_ENABLE_PLUGINS.
+
- Layout Engine: breaking API change
+ ICU 55: Layout Engine breaking API change
The LayoutEngine (already deprecated) has had the function
LEFontInstance::getFontTable(LETag, size_t &length)
since ICU 52. Its implementation was optional. In ICU 55, this
@@ -258,7 +270,7 @@
made secure. See LEFontInstance api docs for more detail.
- Deprecations in PluralRules (plurrule.h)
+ ICU 55: Deprecations in PluralRules (plurrule.h)
The following PluralRules methods never had an implementation
but were inadvertently marked @stable; they have now been
deprecated. [#10759]
@@ -267,9 +279,9 @@
int32_t icu::PluralRules::getAllKeywordValues(const UnicodeString&, double*, int32_t, UErrorCode&)
- Deprecate uidna.h functions for IDNA2003 support
+ ICU 55: Deprecate uidna.h functions for IDNA2003 support
The IDNA2003 API has been deprecated; use the API for IDNA2008 / UTS #46 instead via
- uidna_openUTS46() or class IDNA [#8477].
+ uidna_openUTS46() or class IDNA [#8477].
This applies to the following:
- enum value UIDNA_ALLOW_UNASSIGNED
@@ -281,7 +293,7 @@
- Deprecation (in ICU 54): Layout Engine
+ ICU 54: Deprecation of Layout Engine
The LayoutEngine is now deprecated. Please
see the
User's Guide for more details and migration recommendations.
@@ -295,17 +307,18 @@
instead of ICU as the layout engine. See
the users' guide for more information about how to build.
- Deprecation (in ICU 54): Collation Short Strings
+ ICU 54: Deprecation of Collation Short Strings
The collation short naming scheme and its API functions are deprecated.
Use ucol_open() with language tag collation keywords instead (see Collation API Details). For example, ucol_open("de-u-co-phonebk-ka-shifted", &errorCode)
for German Phonebook order with "ignore punctuation" mode.
- Deprecation (in ICU 54): UCOL_TAILORINGS_VERSION
+ ICU 54: Deprecation of UCOL_TAILORINGS_VERSION
This was originally intended to be the version of collation tailorings,
but that information is actually in the tailorings data and this
constant has always been (and now will continue to be) 1.
- Deprecation (in ICU 53): TimeUnitFormat
+
+ ICU 53: Deprecation of TimeUnitFormat
The TimeUnitFormat and its methods were actually deprecated in ICU 53 and the
class as a whole was tagged as deprecated in that release, but the status tags for
the individual methods did not correctly indicate the deprecated status; they
@@ -318,7 +331,7 @@
For more news about this release, as well as late-breaking news, see the
ICU download page.
-
+
diff --git a/icu4c/source/i18n/dtfmtsym.cpp b/icu4c/source/i18n/dtfmtsym.cpp
index 3f7f3663f19..e99670d4c5d 100644
--- a/icu4c/source/i18n/dtfmtsym.cpp
+++ b/icu4c/source/i18n/dtfmtsym.cpp
@@ -51,18 +51,30 @@
* resource data.
*/
+#if UDAT_HAS_PATTERN_CHAR_FOR_TIME_SEPARATOR
#define PATTERN_CHARS_LEN 36
+#else
+#define PATTERN_CHARS_LEN 35
+#endif
/**
* Unlocalized date-time pattern characters. For example: 'y', 'd', etc. All
* locales use the same these unlocalized pattern characters.
*/
static const UChar gPatternChars[] = {
+#if UDAT_HAS_PATTERN_CHAR_FOR_TIME_SEPARATOR
// GyMdkHmsSEDFwWahKzYeugAZvcLQqVUOXxr:
+#else
+ // GyMdkHmsSEDFwWahKzYeugAZvcLQqVUOXxr
+#endif
0x47, 0x79, 0x4D, 0x64, 0x6B, 0x48, 0x6D, 0x73, 0x53, 0x45,
0x44, 0x46, 0x77, 0x57, 0x61, 0x68, 0x4B, 0x7A, 0x59, 0x65,
0x75, 0x67, 0x41, 0x5A, 0x76, 0x63, 0x4c, 0x51, 0x71, 0x56,
+#if UDAT_HAS_PATTERN_CHAR_FOR_TIME_SEPARATOR
0x55, 0x4F, 0x58, 0x78, 0x72, 0x3a, 0
+#else
+ 0x55, 0x4F, 0x58, 0x78, 0x72, 0
+#endif
};
/* length of an array */
diff --git a/icu4c/source/i18n/smpdtfmt.cpp b/icu4c/source/i18n/smpdtfmt.cpp
index 76c29a6c091..c971891b047 100644
--- a/icu4c/source/i18n/smpdtfmt.cpp
+++ b/icu4c/source/i18n/smpdtfmt.cpp
@@ -209,7 +209,11 @@ static const int32_t gFieldRangeBias[] = {
-1, // 'X' - UDAT_TIMEZONE_ISO_FIELD
-1, // 'x' - UDAT_TIMEZONE_ISO_LOCAL_FIELD
-1, // 'r' - UDAT_RELATED_YEAR_FIELD
+#if UDAT_HAS_PATTERN_CHAR_FOR_TIME_SEPARATOR
-1, // ':' - UDAT_TIME_SEPARATOR_FIELD
+#else
+ -1, // (no pattern character currently) - UDAT_TIME_SEPARATOR_FIELD
+#endif
};
// When calendar uses hebr numbering (i.e. he@calendar=hebrew),
@@ -1088,8 +1092,13 @@ int32_t SimpleDateFormat::getLevelFromChar(UChar ch) {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
// ! " # $ % & ' ( ) * + , - . /
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+#if UDAT_HAS_PATTERN_CHAR_FOR_TIME_SEPARATOR
// 0 1 2 3 4 5 6 7 8 9 : ; < = > ?
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1,
+#else
+ // 0 1 2 3 4 5 6 7 8 9 : ; < = > ?
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+#endif
// @ A B C D E F G H I J K L M N O
-1, 40, -1, -1, 20, 30, 30, 0, 50, -1, -1, 50, 20, 20, -1, 0,
// P Q R S T U V W X Y Z [ \ ] ^ _
@@ -1119,8 +1128,13 @@ UBool SimpleDateFormat::isSyntaxChar(UChar ch) {
FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
// 0 1 2 3 4 5 6 7
FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
+#if UDAT_HAS_PATTERN_CHAR_FOR_TIME_SEPARATOR
// 8 9 : ; < = > ?
FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE,
+#else
+ // 8 9 : ; < = > ?
+ FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
+#endif
// @ A B C D E F G
FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
// H I J K L M N O
@@ -1164,7 +1178,11 @@ SimpleDateFormat::fgPatternIndexToCalendarField[] =
/*O*/ UCAL_ZONE_OFFSET,
/*Xx*/ UCAL_ZONE_OFFSET, UCAL_ZONE_OFFSET,
/*r*/ UCAL_EXTENDED_YEAR,
+#if UDAT_HAS_PATTERN_CHAR_FOR_TIME_SEPARATOR
/*:*/ UCAL_FIELD_COUNT, /* => no useful mapping to any calendar field */
+#else
+ /*no pattern char for UDAT_TIME_SEPARATOR_FIELD*/ UCAL_FIELD_COUNT, /* => no useful mapping to any calendar field */
+#endif
};
// Map index into pattern character string to DateFormat field number
@@ -1188,7 +1206,11 @@ SimpleDateFormat::fgPatternIndexToDateFormatField[] = {
/*O*/ UDAT_TIMEZONE_LOCALIZED_GMT_OFFSET_FIELD,
/*Xx*/ UDAT_TIMEZONE_ISO_FIELD, UDAT_TIMEZONE_ISO_LOCAL_FIELD,
/*r*/ UDAT_RELATED_YEAR_FIELD,
+#if UDAT_HAS_PATTERN_CHAR_FOR_TIME_SEPARATOR
/*:*/ UDAT_TIME_SEPARATOR_FIELD,
+#else
+ /*no pattern char for UDAT_TIME_SEPARATOR_FIELD*/ UDAT_TIME_SEPARATOR_FIELD,
+#endif
};
//----------------------------------------------------------------------
@@ -1628,7 +1650,8 @@ SimpleDateFormat::subFormat(UnicodeString &appendTo,
}
break;
- // for ":", write out the time separator string
+ // if we see pattern character for UDAT_TIME_SEPARATOR_FIELD (none currently defined),
+ // write out the time separator string. Leave support in for future definition.
case UDAT_TIME_SEPARATOR_FIELD:
{
UnicodeString separator;
@@ -3240,7 +3263,9 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
}
return -start;
}
- case UDAT_TIME_SEPARATOR_FIELD: // ':'
+ // currently no pattern character is defined for UDAT_TIME_SEPARATOR_FIELD
+ // so we shoul dnot get here. Leave support in for future definition.
+ case UDAT_TIME_SEPARATOR_FIELD: //
{
static const UChar def_sep = DateFormatSymbols::DEFAULT_TIME_SEPARATOR;
static const UChar alt_sep = DateFormatSymbols::ALTERNATE_TIME_SEPARATOR;
diff --git a/icu4c/source/i18n/unicode/udat.h b/icu4c/source/i18n/unicode/udat.h
index 532613a0637..74de7bb8610 100644
--- a/icu4c/source/i18n/unicode/udat.h
+++ b/icu4c/source/i18n/unicode/udat.h
@@ -763,8 +763,9 @@ typedef enum UDateFormatField {
#ifndef U_HIDE_DRAFT_API
/**
- * FieldPosition and UFieldPosition selector for ':' time separator,
- * no corresponding UCAL_ field.
+ * FieldPosition and UFieldPosition selector for time separator,
+ * no corresponding UCAL_ field. No pattern character is currently
+ * defined for this.
* @draft ICU 55
*/
UDAT_TIME_SEPARATOR_FIELD = 35,
@@ -783,6 +784,16 @@ typedef enum UDateFormatField {
} UDateFormatField;
+#ifndef U_HIDE_INTERNAL_API
+/**
+ * Is a pattern character defined for UDAT_TIME_SEPARATOR_FIELD?
+ * In ICU 55 it was COLON, but that was withdrawn in ICU 56.
+ * @internal ICU 56
+ */
+#define UDAT_HAS_PATTERN_CHAR_FOR_TIME_SEPARATOR 0
+#endif /* U_HIDE_INTERNAL_API */
+
+
/**
* Maps from a UDateFormatField to the corresponding UCalendarDateFields.
* Note: since the mapping is many-to-one, there is no inverse mapping.
diff --git a/icu4c/source/test/cintltst/cdattst.c b/icu4c/source/test/cintltst/cdattst.c
index 6ccca4b33d3..c52c9821d79 100644
--- a/icu4c/source/test/cintltst/cdattst.c
+++ b/icu4c/source/test/cintltst/cdattst.c
@@ -678,7 +678,11 @@ static void TestSymbols()
VerifygetSymbols(zhChiCal, UDAT_CYCLIC_YEARS_NARROW, 59, "\\u7678\\u4EA5");
VerifygetSymbols(zhChiCal, UDAT_ZODIAC_NAMES_ABBREVIATED, 0, "\\u9F20");
VerifygetSymbols(zhChiCal, UDAT_ZODIAC_NAMES_WIDE, 11, "\\u732A");
+#if UDAT_HAS_PATTERN_CHAR_FOR_TIME_SEPARATOR
VerifygetSymbols(def,UDAT_LOCALIZED_CHARS, 0, "GyMdkHmsSEDFwWahKzYeugAZvcLQqVUOXxr:");
+#else
+ VerifygetSymbols(def,UDAT_LOCALIZED_CHARS, 0, "GyMdkHmsSEDFwWahKzYeugAZvcLQqVUOXxr");
+#endif
if(result != NULL) {
@@ -1756,9 +1760,13 @@ static const FieldsData expectedFields[] = {
{ UDAT_DATE_FIELD /* 3*/, 20, 22 },
{ UDAT_YEAR_FIELD /* 1*/, 24, 28 },
{ UDAT_HOUR1_FIELD /*15*/, 32, 33 },
+#if UDAT_HAS_PATTERN_CHAR_FOR_TIME_SEPARATOR
{ UDAT_TIME_SEPARATOR_FIELD /*35*/, 33, 34 },
+#endif
{ UDAT_MINUTE_FIELD /* 6*/, 34, 36 },
+#if UDAT_HAS_PATTERN_CHAR_FOR_TIME_SEPARATOR
{ UDAT_TIME_SEPARATOR_FIELD /*35*/, 36, 37 },
+#endif
{ UDAT_SECOND_FIELD /* 7*/, 37, 39 },
{ UDAT_AM_PM_FIELD /*14*/, 40, 42 },
{ UDAT_TIMEZONE_FIELD /*17*/, 43, 46 },
diff --git a/icu4c/source/test/intltest/dtfmttst.cpp b/icu4c/source/test/intltest/dtfmttst.cpp
index 61b290e2165..7c153246765 100644
--- a/icu4c/source/test/intltest/dtfmttst.cpp
+++ b/icu4c/source/test/intltest/dtfmttst.cpp
@@ -433,7 +433,11 @@ DateFormatTest::escape(UnicodeString& s)
/**
* This MUST be kept in sync with DateFormatSymbols.gPatternChars.
*/
+#if UDAT_HAS_PATTERN_CHAR_FOR_TIME_SEPARATOR
static const char* PATTERN_CHARS = "GyMdkHmsSEDFwWahKzYeugAZvcLQqVUOXxr:";
+#else
+static const char* PATTERN_CHARS = "GyMdkHmsSEDFwWahKzYeugAZvcLQqVUOXxr";
+#endif
/**
* A list of the names of all the fields in DateFormat.
@@ -501,7 +505,11 @@ void DateFormatTest::TestFieldPosition() {
assertEquals("patternChars", PATTERN_CHARS, rootSyms.getLocalPatternChars(buf));
assertEquals("patternChars", PATTERN_CHARS, DateFormatSymbols::getPatternUChars());
assertTrue("DATEFORMAT_FIELD_NAMES", DATEFORMAT_FIELD_NAMES_LENGTH == UDAT_FIELD_COUNT);
+#if UDAT_HAS_PATTERN_CHAR_FOR_TIME_SEPARATOR
assertTrue("Data", UDAT_FIELD_COUNT == uprv_strlen(PATTERN_CHARS));
+#else
+ // assertTrue("Data", UDAT_FIELD_COUNT == uprv_strlen(PATTERN_CHARS)); // test invalid if no pattern char for UDAT_TIME_SEPARATOR_FIELD
+#endif
// Create test formatters
const int32_t COUNT = 4;
@@ -531,22 +539,38 @@ void DateFormatTest::TestFieldPosition() {
"", "1997", "August", "13", "", "", "34", "12", "", "Wednesday",
"", "", "", "", "PM", "2", "", "Pacific Daylight Time", "", "",
"", "", "", "", "", "", "", "", "", "",
+#if UDAT_HAS_PATTERN_CHAR_FOR_TIME_SEPARATOR
"", "", "", "", "", ":",
+#else
+ "", "", "", "", "", "",
+#endif
"", "1997", "ao\\u00FBt", "13", "", "14", "34", "12", "", "mercredi",
"", "", "", "", "", "", "", "heure d\\u2019\\u00E9t\\u00E9 du Pacifique", "", "",
"", "", "", "", "", "", "", "", "", "",
+#if UDAT_HAS_PATTERN_CHAR_FOR_TIME_SEPARATOR
"", "", "", "", "", ":",
+#else
+ "", "", "", "", "", "",
+#endif
"AD", "1997", "8", "13", "14", "14", "34", "12", "5", "Wed",
"225", "2", "33", "3", "PM", "2", "2", "PDT", "1997", "4",
"1997", "2450674", "52452513", "-0700", "PT", "4", "8", "3", "3", "uslax",
+#if UDAT_HAS_PATTERN_CHAR_FOR_TIME_SEPARATOR
"1997", "GMT-7", "-07", "-07", "1997", ":",
+#else
+ "1997", "GMT-7", "-07", "-07", "1997", "",
+#endif
"Anno Domini", "1997", "August", "0013", "0014", "0014", "0034", "0012", "5130", "Wednesday",
"0225", "0002", "0033", "0003", "PM", "0002", "0002", "Pacific Daylight Time", "1997", "Wednesday",
"1997", "2450674", "52452513", "GMT-07:00", "Pacific Time", "Wednesday", "August", "3rd quarter", "3rd quarter", "Los Angeles Time",
+#if UDAT_HAS_PATTERN_CHAR_FOR_TIME_SEPARATOR
"1997", "GMT-07:00", "-0700", "-0700", "1997", ":",
+#else
+ "1997", "GMT-07:00", "-0700", "-0700", "1997", "",
+#endif
};
const int32_t EXPECTED_LENGTH = sizeof(EXPECTED)/sizeof(EXPECTED[0]);