ICU-5891 Updates per code review. Also added new data-driven test case.
X-SVN-Rev: 22861
This commit is contained in:
parent
2acc63bddc
commit
233ddab1bc
@ -245,11 +245,7 @@ UCNV_FROM_U_CALLBACK_ESCAPE (
|
||||
|
||||
case UCNV_PRV_ESCAPE_CSS2:
|
||||
valueString[valueStringLength++] = (UChar) UNICODE_RS_CODEPOINT; /* adding \ */
|
||||
if (length == 2) {
|
||||
valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, codePoint, 16, 0);
|
||||
} else {
|
||||
valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, (uint16_t)codeUnits[0], 16, 0);
|
||||
}
|
||||
valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, codePoint, 16, 0);
|
||||
/* Always add space character, becase the next character might be whitespace,
|
||||
which would erroneously be considered the termination of the escape sequence. */
|
||||
valueString[valueStringLength++] = (UChar) UNICODE_SPACE_CODEPOINT;
|
||||
|
@ -140,9 +140,9 @@ typedef struct UConverter UConverter;
|
||||
#define UCNV_ESCAPE_UNICODE "U"
|
||||
|
||||
/**
|
||||
* FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to CSS2 conventions (\\X{XXXXX} followed by
|
||||
* a space.
|
||||
* @stable ICU 4.0
|
||||
* FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to CSS2 conventions (\\HH..H<space>, that is,
|
||||
* a backslash, 1..6 hex digits, and a space)
|
||||
* @draft ICU 4.0
|
||||
*/
|
||||
#define UCNV_ESCAPE_CSS2 "S"
|
||||
|
||||
|
8
icu4c/source/test/testdata/conversion.txt
vendored
8
icu4c/source/test/testdata/conversion.txt
vendored
@ -917,6 +917,14 @@ conversion:table(nofallback) {
|
||||
:intvector{ -1,-1,-1,-1,0,1,2,2,2,3,3,5,5,5 },
|
||||
:int{1}, :int{1}, "", "?\x00\x2f\x7e", ""
|
||||
}
|
||||
// ISO-2022-KR
|
||||
{
|
||||
"ibm-25546",
|
||||
"AB\uc88b\U00050005\uacccC",
|
||||
:bin{ 1b24294341420e41410f5c3530303035200e306a0f43 },
|
||||
:intvector{ -1,-1,-1,-1,0,1,2,2,2,3,3,3,3,3,3,3,3,5,5,5,6,6 },
|
||||
:int{1}, :int{1}, "", "&S", ""
|
||||
}
|
||||
|
||||
// ISO-2022-JP-2 with G2 designator & SS2 shift
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user