diff --git a/icu4c/source/i18n/ulocdata.c b/icu4c/source/i18n/ulocdata.c index 19f3bf42b61..5034bb7a2c2 100644 --- a/icu4c/source/i18n/ulocdata.c +++ b/icu4c/source/i18n/ulocdata.c @@ -1,7 +1,7 @@ /* ****************************************************************************** * * -* Copyright (C) 2003-2012, International Business Machines * +* Copyright (C) 2003-2013, International Business Machines * * Corporation and others. All Rights Reserved. * * * ****************************************************************************** @@ -102,7 +102,8 @@ ulocdata_getExemplarSet(ULocaleData *uld, USet *fillIn, static const char* const exemplarSetTypes[] = { "ExemplarCharacters", "AuxExemplarCharacters", - "ExemplarCharactersIndex"}; + "ExemplarCharactersIndex", + "ExemplarCharactersPunctuation"}; const UChar *exemplarChars = NULL; int32_t len = 0; UErrorCode localStatus = U_ZERO_ERROR; diff --git a/icu4c/source/i18n/unicode/ulocdata.h b/icu4c/source/i18n/unicode/ulocdata.h index d9dd79e5208..2dd2c12a3e2 100644 --- a/icu4c/source/i18n/unicode/ulocdata.h +++ b/icu4c/source/i18n/unicode/ulocdata.h @@ -1,7 +1,7 @@ /* ****************************************************************************** * * -* Copyright (C) 2003-2012, International Business Machines * +* Copyright (C) 2003-2013, International Business Machines * * Corporation and others. All Rights Reserved. * * * ****************************************************************************** @@ -45,8 +45,10 @@ typedef enum ULocaleDataExemplarSetType { ULOCDATA_ES_AUXILIARY=1, /** Index Character set @stable ICU 4.8 */ ULOCDATA_ES_INDEX=2, + /** Punctuation set @draft ICU 51 */ + ULOCDATA_ES_PUNCTUATION=3, /** One higher than the last valid type @stable ICU 3.4 */ - ULOCDATA_ES_COUNT=3 + ULOCDATA_ES_COUNT=4 } ULocaleDataExemplarSetType; /** The possible types of delimiters. diff --git a/icu4c/source/test/cintltst/cloctst.c b/icu4c/source/test/cintltst/cloctst.c index e3c6d717ace..81171da69b5 100644 --- a/icu4c/source/test/cintltst/cloctst.c +++ b/icu4c/source/test/cintltst/cloctst.c @@ -1,6 +1,6 @@ /******************************************************************** * COPYRIGHT: - * Copyright (c) 1997-2012, International Business Machines Corporation and + * Copyright (c) 1997-2013, International Business Machines Corporation and * others. All Rights Reserved. ********************************************************************/ /***************************************************************************** @@ -244,6 +244,7 @@ void addLocaleTest(TestNode** root) TESTCASE(TestForLanguageTag); TESTCASE(TestTrailingNull); TESTCASE(TestUnicodeDefines); + TESTCASE(TestEnglishExemplarCharacters); } @@ -2509,6 +2510,39 @@ static void TestGetLocale(void) { } #endif } +static void TestEnglishExemplarCharacters(void) { + UErrorCode status = U_ZERO_ERROR; + int i; + USet *exSet = NULL; + UChar testChars[] = { + 0x61, /* standard */ + 0xE1, /* auxiliary */ + 0x41, /* index */ + 0x2D /* punctuation */ + }; + ULocaleData *uld = ulocdata_open("en", &status); + if (U_FAILURE(status)) { + log_err("ulocdata_open() failed\n"); + return; + } + + for (i = 0; i < ULOCDATA_ES_COUNT; i++) { + exSet = ulocdata_getExemplarSet(uld, exSet, 0, (ULocaleDataExemplarSetType)i, &status); + if (U_FAILURE(status)) { + /* until pucntuation data problem is resolved */ + /* log_err_status(status, "ulocdata_getExemplarSet() for type %d failed\n", i); */ + log_verbose("ulocdata_getExemplarSet() for type %d failed\n", i); + status = U_ZERO_ERROR; + continue; + } + if (!uset_contains(exSet, (UChar32)testChars[i])) { + log_err("Character U+%04X is not included in exemplar type %d\n", testChars[i], i); + } + } + + uset_close(exSet); + ulocdata_close(uld); +} static void TestNonexistentLanguageExemplars(void) { /* JB 4068 - Nonexistent language */ diff --git a/icu4c/source/test/cintltst/cloctst.h b/icu4c/source/test/cintltst/cloctst.h index a544f31a02c..ac313b3eb9a 100644 --- a/icu4c/source/test/cintltst/cloctst.h +++ b/icu4c/source/test/cintltst/cloctst.h @@ -1,6 +1,6 @@ /******************************************************************** * COPYRIGHT: - * Copyright (c) 1997-2010, International Business Machines Corporation and + * Copyright (c) 1997-2013, International Business Machines Corporation and * others. All Rights Reserved. ********************************************************************/ /******************************************************************************** @@ -122,4 +122,10 @@ static void TestLikelySubtags(void); */ static void TestForLanguageTag(void); static void TestToLanguageTag(void); + +/** + * locale data + */ +static void TestEnglishExemplarCharacters(void); + #endif