if (change) {
ByteSinkUtil::appendTwoBytes(upper, sink);
if ((data & HAS_EITHER_DIALYTIKA) != 0) {
- sink.Append(u8"\u0308", 2); // restore or add a dialytika
+ sink.Append(reinterpret_cast<const char*>(u8"\u0308"), 2); // restore or add a dialytika
}
if (addTonos) {
- sink.Append(u8"\u0301", 2);
+ sink.Append(reinterpret_cast<const char*>(u8"\u0301"), 2);
}
while (numYpogegrammeni > 0) {
- sink.Append(u8"\u0399", 2);
+ sink.Append(reinterpret_cast<const char*>(u8"\u0399"), 2);
--numYpogegrammeni;
}
}
static const char *strings[] = {
// string with U+FFFD == illegal byte sequence
- u8"a\uFFFDz", "a\x80z", // trail byte
- u8"a\uFFFD\uFFFDz", "a\xc1\x81z", // non-shortest form
- u8"a\uFFFD\uFFFD\uFFFDz", "a\xe0\x82\x83z", // non-shortest form
- u8"a\uFFFD\uFFFD\uFFFDz", "a\xed\xa0\x80z", // lead surrogate: would be U+D800
- u8"a\uFFFD\uFFFD\uFFFDz", "a\xed\xbf\xbfz", // trail surrogate: would be U+DFFF
- u8"a\uFFFD\uFFFD\uFFFD\uFFFDz", "a\xf0\x8f\xbf\xbfz", // non-shortest form
- u8"a\uFFFD\uFFFD\uFFFD\uFFFDz", "a\xf4\x90\x80\x80z" // out of range: would be U+110000
+ reinterpret_cast<const char*>(u8"a\uFFFDz"), reinterpret_cast<const char*>("a\x80z"), // trail byte
+ reinterpret_cast<const char*>(u8"a\uFFFD\uFFFDz"), reinterpret_cast<const char*>("a\xc1\x81z"), // non-shortest form
+ reinterpret_cast<const char*>(u8"a\uFFFD\uFFFD\uFFFDz"), reinterpret_cast<const char*>("a\xe0\x82\x83z"), // non-shortest form
+ reinterpret_cast<const char*>(u8"a\uFFFD\uFFFD\uFFFDz"), reinterpret_cast<const char*>("a\xed\xa0\x80z"), // lead surrogate: would be U+D800
+ reinterpret_cast<const char*>(u8"a\uFFFD\uFFFD\uFFFDz"), reinterpret_cast<const char*>("a\xed\xbf\xbfz"), // trail surrogate: would be U+DFFF
+ reinterpret_cast<const char*>(u8"a\uFFFD\uFFFD\uFFFD\uFFFDz"), reinterpret_cast<const char*>("a\xf0\x8f\xbf\xbfz"), // non-shortest form
+ reinterpret_cast<const char*>(u8"a\uFFFD\uFFFD\uFFFD\uFFFDz"), reinterpret_cast<const char*>("a\xf4\x90\x80\x80z") // out of range: would be U+110000
};
for(int32_t i = 0; i < UPRV_LENGTHOF(strings); i += 2) {
{123456789012345.0, "\\u00A5120\\u4E07\\u4EBF"},
};
static ExpectedResult kGermanCurrencyTestData[] = {
- {1.0, u8"1\\u00A0\\u20AC"},
- {12.0, u8"12\\u00A0\\u20AC"},
- {123.0, u8"120\\u00A0\\u20AC"},
- {1234.0, u8"1200\\u00A0\\u20AC"},
- {12345.0, u8"12.000\\u00A0\\u20AC"},
- {123456.0, u8"120.000\\u00A0\\u20AC"},
- {1234567.0, u8"1,2\\u00A0Mio.\\u00A0\\u20AC"},
- {12345678.0, u8"12\\u00A0Mio.\\u00A0\\u20AC"},
- {123456789.0, u8"120\\u00A0Mio.\\u00A0\\u20AC"},
- {1234567890.0, u8"1,2\\u00A0Mrd.\\u00A0\\u20AC"},
- {12345678901.0, u8"12\\u00A0Mrd.\\u00A0\\u20AC"},
- {123456789012.0, u8"120\\u00A0Mrd.\\u00A0\\u20AC"},
- {1234567890123.0, u8"1,2\\u00A0Bio.\\u00A0\\u20AC"},
- {12345678901234.0, u8"12\\u00A0Bio.\\u00A0\\u20AC"},
- {123456789012345.0, u8"120\\u00A0Bio.\\u00A0\\u20AC"},
+ {1.0, reinterpret_cast<const char*>(u8"1\\u00A0\\u20AC")},
+ {12.0, reinterpret_cast<const char*>(u8"12\\u00A0\\u20AC")},
+ {123.0, reinterpret_cast<const char*>(u8"120\\u00A0\\u20AC")},
+ {1234.0, reinterpret_cast<const char*>(u8"1200\\u00A0\\u20AC")},
+ {12345.0, reinterpret_cast<const char*>(u8"12.000\\u00A0\\u20AC")},
+ {123456.0, reinterpret_cast<const char*>(u8"120.000\\u00A0\\u20AC")},
+ {1234567.0, reinterpret_cast<const char*>(u8"1,2\\u00A0Mio.\\u00A0\\u20AC")},
+ {12345678.0, reinterpret_cast<const char*>(u8"12\\u00A0Mio.\\u00A0\\u20AC")},
+ {123456789.0, reinterpret_cast<const char*>(u8"120\\u00A0Mio.\\u00A0\\u20AC")},
+ {1234567890.0, reinterpret_cast<const char*>(u8"1,2\\u00A0Mrd.\\u00A0\\u20AC")},
+ {12345678901.0, reinterpret_cast<const char*>(u8"12\\u00A0Mrd.\\u00A0\\u20AC")},
+ {123456789012.0, reinterpret_cast<const char*>(u8"120\\u00A0Mrd.\\u00A0\\u20AC")},
+ {1234567890123.0, reinterpret_cast<const char*>(u8"1,2\\u00A0Bio.\\u00A0\\u20AC")},
+ {12345678901234.0, reinterpret_cast<const char*>(u8"12\\u00A0Bio.\\u00A0\\u20AC")},
+ {123456789012345.0, reinterpret_cast<const char*>(u8"120\\u00A0Bio.\\u00A0\\u20AC")},
};
static ExpectedResult kEnglishCurrencyTestData[] = {
- {1.0, u8"$1"},
- {12.0, u8"$12"},
- {123.0, u8"$120"},
- {1234.0, u8"$1.2K"},
- {12345.0, u8"$12K"},
- {123456.0, u8"$120K"},
- {1234567.0, u8"$1.2M"},
- {12345678.0, u8"$12M"},
- {123456789.0, u8"$120M"},
- {1234567890.0, u8"$1.2B"},
- {12345678901.0, u8"$12B"},
- {123456789012.0, u8"$120B"},
- {1234567890123.0, u8"$1.2T"},
- {12345678901234.0, u8"$12T"},
- {123456789012345.0, u8"$120T"},
+ {1.0, reinterpret_cast<const char*>(u8"$1")},
+ {12.0, reinterpret_cast<const char*>(u8"$12")},
+ {123.0, reinterpret_cast<const char*>(u8"$120")},
+ {1234.0, reinterpret_cast<const char*>(u8"$1.2K")},
+ {12345.0, reinterpret_cast<const char*>(u8"$12K")},
+ {123456.0, reinterpret_cast<const char*>(u8"$120K")},
+ {1234567.0, reinterpret_cast<const char*>(u8"$1.2M")},
+ {12345678.0, reinterpret_cast<const char*>(u8"$12M")},
+ {123456789.0, reinterpret_cast<const char*>(u8"$120M")},
+ {1234567890.0, reinterpret_cast<const char*>(u8"$1.2B")},
+ {12345678901.0, reinterpret_cast<const char*>(u8"$12B")},
+ {123456789012.0, reinterpret_cast<const char*>(u8"$120B")},
+ {1234567890123.0, reinterpret_cast<const char*>(u8"$1.2T")},
+ {12345678901234.0, reinterpret_cast<const char*>(u8"$12T")},
+ {123456789012345.0, reinterpret_cast<const char*>(u8"$120T")},
};
REGEX_ASSERT(status == U_REGEX_TIME_OUT);
// UText, wrapping non-UTF-16 text, also takes a different execution path.
- const char *text8 = u8"¿Qué es Unicode? Unicode proporciona un número único para cada"
+ const char *text8 = reinterpret_cast<const char*>(u8"¿Qué es Unicode? Unicode proporciona un número único para cada"
"carácter, sin importar la plataforma, sin importar el programa,"
- "sin importar el idioma.";
+ "sin importar el idioma.");
status = U_ZERO_ERROR;
LocalUTextPointer ut(utext_openUTF8(NULL, text8, -1, &status));
REGEX_CHECK_STATUS;
Edits edits;
int32_t length = CaseMap::utf8ToLower("tr", U_OMIT_UNCHANGED_TEXT,
- u8"IstanBul", 8, dest, UPRV_LENGTHOF(dest), &edits, errorCode);
+ reinterpret_cast<const char*>(u8"IstanBul"), 8, dest, UPRV_LENGTHOF(dest), &edits, errorCode);
assertEquals(u"toLower(IstanBul)", UnicodeString(u"ıb"),
UnicodeString::fromUTF8(StringPiece(dest, length)));
static const EditChange lowerExpectedChanges[] = {
edits.reset();
length = CaseMap::utf8ToUpper("el", U_OMIT_UNCHANGED_TEXT,
- u8"Πατάτα", 6 * 2, dest, UPRV_LENGTHOF(dest), &edits, errorCode);
+ reinterpret_cast<const char*>(u8"Πατάτα"), 6 * 2, dest, UPRV_LENGTHOF(dest), &edits, errorCode);
assertEquals(u"toUpper(Πατάτα)", UnicodeString(u"ΑΤΑΤΑ"),
UnicodeString::fromUTF8(StringPiece(dest, length)));
static const EditChange upperExpectedChanges[] = {
U_OMIT_UNCHANGED_TEXT |
U_TITLECASE_NO_BREAK_ADJUSTMENT |
U_TITLECASE_NO_LOWERCASE,
- nullptr, u8"IjssEL IglOo", 12,
+ nullptr, reinterpret_cast<const char*>(u8"IjssEL IglOo"), 12,
dest, UPRV_LENGTHOF(dest), &edits, errorCode);
assertEquals(u"toTitle(IjssEL IglOo)", UnicodeString(u"J"),
UnicodeString::fromUTF8(StringPiece(dest, length)));
// No explicit nor automatic edits.reset(). Edits should be appended.
length = CaseMap::utf8Fold(U_OMIT_UNCHANGED_TEXT | U_EDITS_NO_RESET |
U_FOLD_CASE_EXCLUDE_SPECIAL_I,
- u8"IßtanBul", 1 + 2 + 6, dest, UPRV_LENGTHOF(dest), &edits, errorCode);
+ reinterpret_cast<const char*>(u8"IßtanBul"), 1 + 2 + 6, dest, UPRV_LENGTHOF(dest), &edits, errorCode);
assertEquals(u"foldCase(IßtanBul)", UnicodeString(u"ıssb"),
UnicodeString::fromUTF8(StringPiece(dest, length)));
static const EditChange foldExpectedChanges[] = {
StringByteSink<std::string> sink(&dest);
// Omit unchanged text.
- CaseMap::utf8ToLower("tr", U_OMIT_UNCHANGED_TEXT, u8"IstanBul", sink, nullptr, errorCode);
+ CaseMap::utf8ToLower("tr", U_OMIT_UNCHANGED_TEXT, reinterpret_cast<const char*>(u8"IstanBul"), sink, nullptr, errorCode);
assertEquals(u"toLower(IstanBul)", UnicodeString(u"ıb"), UnicodeString::fromUTF8(dest));
dest.clear();
- CaseMap::utf8ToUpper("el", U_OMIT_UNCHANGED_TEXT, u8"Πατάτα", sink, nullptr, errorCode);
+ CaseMap::utf8ToUpper("el", U_OMIT_UNCHANGED_TEXT, reinterpret_cast<const char*>(u8"Πατάτα"), sink, nullptr, errorCode);
assertEquals(u"toUpper(Πατάτα)", UnicodeString(u"ΑΤΑΤΑ"),
UnicodeString::fromUTF8(dest));
#if !UCONFIG_NO_BREAK_ITERATION
dest.clear();
CaseMap::utf8ToTitle(
"nl", U_OMIT_UNCHANGED_TEXT | U_TITLECASE_NO_BREAK_ADJUSTMENT | U_TITLECASE_NO_LOWERCASE,
- nullptr, u8"IjssEL IglOo", sink, nullptr, errorCode);
+ nullptr, reinterpret_cast<const char*>(u8"IjssEL IglOo"), sink, nullptr, errorCode);
assertEquals(u"toTitle(IjssEL IglOo)", UnicodeString(u"J"),
UnicodeString::fromUTF8(dest));
#endif
dest.clear();
CaseMap::utf8Fold(U_OMIT_UNCHANGED_TEXT | U_FOLD_CASE_EXCLUDE_SPECIAL_I,
- u8"IßtanBul", sink, nullptr, errorCode);
+ reinterpret_cast<const char*>(u8"IßtanBul"), sink, nullptr, errorCode);
assertEquals(u"foldCase(IßtanBul)", UnicodeString(u"ıssb"),
UnicodeString::fromUTF8(dest));
// Return the whole result string.
dest.clear();
- CaseMap::utf8ToLower("tr", 0, u8"IstanBul", sink, nullptr, errorCode);
+ CaseMap::utf8ToLower("tr", 0, reinterpret_cast<const char*>(u8"IstanBul"), sink, nullptr, errorCode);
assertEquals(u"toLower(IstanBul)", UnicodeString(u"ıstanbul"),
UnicodeString::fromUTF8(dest));
dest.clear();
- CaseMap::utf8ToUpper("el", 0, u8"Πατάτα", sink, nullptr, errorCode);
+ CaseMap::utf8ToUpper("el", 0, reinterpret_cast<const char*>(u8"Πατάτα"), sink, nullptr, errorCode);
assertEquals(u"toUpper(Πατάτα)", UnicodeString(u"ΠΑΤΑΤΑ"),
UnicodeString::fromUTF8(dest));
#if !UCONFIG_NO_BREAK_ITERATION
dest.clear();
CaseMap::utf8ToTitle("nl", U_TITLECASE_NO_BREAK_ADJUSTMENT | U_TITLECASE_NO_LOWERCASE,
- nullptr, u8"IjssEL IglOo", sink, nullptr, errorCode);
+ nullptr, reinterpret_cast<const char*>(u8"IjssEL IglOo"), sink, nullptr, errorCode);
assertEquals(u"toTitle(IjssEL IglOo)", UnicodeString(u"IJssEL IglOo"),
UnicodeString::fromUTF8(dest));
#endif
dest.clear();
- CaseMap::utf8Fold(U_FOLD_CASE_EXCLUDE_SPECIAL_I, u8"IßtanBul", sink, nullptr, errorCode);
+ CaseMap::utf8Fold(U_FOLD_CASE_EXCLUDE_SPECIAL_I, reinterpret_cast<const char*>(u8"IßtanBul"), sink, nullptr, errorCode);
assertEquals(u"foldCase(IßtanBul)", UnicodeString(u"ısstanbul"),
UnicodeString::fromUTF8(dest));
}
return;
}
static const char *const src =
- u8" AÄA\u0308A\u0308\u00ad\u0323Ä\u0323,\u00ad\u1100\u1161가\u11A8가\u3133 ";
- std::string expected = u8" aääạ\u0308ạ\u0308,가각갃 ";
+ reinterpret_cast<const char*>(u8" AÄA\u0308A\u0308\u00ad\u0323Ä\u0323,\u00ad\u1100\u1161가\u11A8가\u3133 ");
+ std::string expected = reinterpret_cast<const char*>(u8" aääạ\u0308ạ\u0308,가각갃 ");
std::string result;
StringByteSink<std::string> sink(&result, static_cast<int32_t>(expected.length()));
Edits edits;
assertTrue("isNormalizedUTF8(normalized)", nfkc_cf->isNormalizedUTF8(result, errorCode));
// Omit unchanged text.
- expected = u8"aääạ\u0308ạ\u0308가각갃";
+ expected = reinterpret_cast<const char*>(u8"aääạ\u0308ạ\u0308가각갃");
result.clear();
edits.reset();
nfkc_cf->normalizeUTF8(U_OMIT_UNCHANGED_TEXT, src, sink, &edits, errorCode);
// With filter: The normalization code does not see the "A" substrings.
UnicodeSet filter(u"[^A]", errorCode);
FilteredNormalizer2 fn2(*nfkc_cf, filter);
- expected = u8" AäA\u0308A\u0323\u0308ạ\u0308,가각갃 ";
+ expected = reinterpret_cast<const char*>(u8" AäA\u0308A\u0323\u0308ạ\u0308,가각갃 ");
result.clear();
edits.reset();
fn2.normalizeUTF8(0, src, sink, &edits, errorCode);
// Omit unchanged text.
// Note that the result is not normalized because the inner normalizer
// does not see text across filter spans.
- expected = u8"ä\u0323\u0308ạ\u0308가각갃";
+ expected = reinterpret_cast<const char*>(u8"ä\u0323\u0308ạ\u0308가각갃");
result.clear();
edits.reset();
fn2.normalizeUTF8(U_OMIT_UNCHANGED_TEXT, src, sink, &edits, errorCode);
assertSuccess("normalize", errorCode.get());
assertEquals("normalize", expected, result);
- std::string src8(u8" A");
- src8.append("\x80").append(u8"ÄA\u0308").append("\xC0\x80").
- append(u8"A\u0308\u00ad\u0323").append("\xED\xA0\x80").
- append(u8"Ä\u0323,\u00ad").append("\xF4\x90\x80\x80").
- append(u8"\u1100\u1161가\u11A8가\u3133 ").append("\xF0");
- std::string expected8(u8" a");
- expected8.append("\x80").append(u8"ää").append("\xC0\x80").
- append(u8"ạ\u0308").append("\xED\xA0\x80").
- append(u8"ạ\u0308,").append("\xF4\x90\x80\x80").
- append(u8"가각갃 ").append("\xF0");
+ std::string src8(reinterpret_cast<const char*>(u8" A"));
+ src8.append("\x80").append(reinterpret_cast<const char*>(u8"ÄA\u0308")).append("\xC0\x80").
+ append(reinterpret_cast<const char*>(u8"A\u0308\u00ad\u0323")).append("\xED\xA0\x80").
+ append(reinterpret_cast<const char*>(u8"Ä\u0323,\u00ad")).append("\xF4\x90\x80\x80").
+ append(reinterpret_cast<const char*>(u8"\u1100\u1161가\u11A8가\u3133 ")).append("\xF0");
+ std::string expected8(reinterpret_cast<const char*>(u8" a"));
+ expected8.append("\x80").append(reinterpret_cast<const char*>(u8"ää")).append("\xC0\x80").
+ append(reinterpret_cast<const char*>(u8"ạ\u0308")).append("\xED\xA0\x80").
+ append(reinterpret_cast<const char*>(u8"ạ\u0308,")).append("\xF4\x90\x80\x80").
+ append(reinterpret_cast<const char*>(u8"가각갃 ")).append("\xF0");
std::string result8;
StringByteSink<std::string> sink(&result8);
nfkc_cf->normalizeUTF8(0, src8, sink, nullptr, errorCode);
assertFalse("isNormalized(LV+11A7)", nfkc->isNormalized(s, errorCode));
assertTrue("isNormalized(normalized)", nfkc->isNormalized(result, errorCode));
- std::string s8(u8"\u1100\u1161\u11A7\u1100\u314F\u11A7가\u11A7");
- std::string expected8(u8"가\u11A7가\u11A7가\u11A7");
+ std::string s8(reinterpret_cast<const char*>(u8"\u1100\u1161\u11A7\u1100\u314F\u11A7가\u11A7"));
+ std::string expected8(reinterpret_cast<const char*>(u8"가\u11A7가\u11A7가\u11A7"));
std::string result8;
StringByteSink<std::string> sink(&result8, static_cast<int32_t>(expected8.length()));
nfkc->normalizeUTF8(0, s8, sink, nullptr, errorCode);
if (*status != u'[') {
errln("%s status field does not start with '[': %s\n %s", type, status, line);
}
- if (strcmp(status, u8"[]") != 0) {
+ if (strcmp(status, reinterpret_cast<const char*>(u8"[]")) != 0) {
expectedHasErrors = TRUE;
}
}