ICU-779 add converter-specific writeSub()
X-SVN-Rev: 3305
This commit is contained in:
parent
f4b79b2e20
commit
058e4e9615
@ -1295,6 +1295,30 @@ callback:
|
|||||||
|
|
||||||
/* miscellaneous ------------------------------------------------------------ */
|
/* miscellaneous ------------------------------------------------------------ */
|
||||||
|
|
||||||
|
U_CFUNC void
|
||||||
|
_SCSUWriteSub(UConverterFromUnicodeArgs *pArgs,
|
||||||
|
int32_t offsetIndex,
|
||||||
|
UErrorCode *pErrorCode) {
|
||||||
|
static const char squ_fffd[]={ (char)SQU, (char)0xff, (char)0xfd };
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The substitution character is U+fffd={ ff, fd }.
|
||||||
|
* If the SCSU converter is in Unicode mode, then these two bytes just need to
|
||||||
|
* be written. Otherwise, this character is quoted.
|
||||||
|
*/
|
||||||
|
if(((SCSUData *)pArgs->converter->extraInfo)->fromUIsSingleByteMode) {
|
||||||
|
/* single-byte mode: quote Unicode */
|
||||||
|
ucnv_cbFromUWriteBytes(pArgs,
|
||||||
|
squ_fffd, 3,
|
||||||
|
offsetIndex, pErrorCode);
|
||||||
|
} else {
|
||||||
|
/* Unicode mode: just write U+fffd */
|
||||||
|
ucnv_cbFromUWriteBytes(pArgs,
|
||||||
|
squ_fffd+1, 2,
|
||||||
|
offsetIndex, pErrorCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static const UConverterImpl _SCSUImpl={
|
static const UConverterImpl _SCSUImpl={
|
||||||
UCNV_SCSU,
|
UCNV_SCSU,
|
||||||
|
|
||||||
@ -1312,7 +1336,8 @@ static const UConverterImpl _SCSUImpl={
|
|||||||
_SCSUGetNextUChar,
|
_SCSUGetNextUChar,
|
||||||
|
|
||||||
NULL,
|
NULL,
|
||||||
NULL
|
NULL,
|
||||||
|
_SCSUWriteSub
|
||||||
};
|
};
|
||||||
|
|
||||||
static const UConverterStaticData _SCSUStaticData={
|
static const UConverterStaticData _SCSUStaticData={
|
||||||
|
Loading…
Reference in New Issue
Block a user