ICU-2404 fully handle <subchar1> and |2 in converters

X-SVN-Rev: 13523
This commit is contained in:
Markus Scherer 2003-10-29 03:21:21 +00:00
parent 4614bfe102
commit 47ca718f33
3 changed files with 10 additions and 2 deletions

View file

@ -663,7 +663,7 @@ ucnv_extMatchFromU(const int32_t *cx,
/* return result */
if(matchValue==UCNV_EXT_FROM_U_SUBCHAR1) {
return 1;
return 1; /* assert matchLength==2 */
}
*pMatchValue=UCNV_EXT_FROM_U_MASK_ROUNDTRIP(matchValue);

View file

@ -269,6 +269,12 @@
* (i.e., "no mapping" with preference for <subchar1> rather than <subchar>),
* and all other items are unique non-zero results.
*
* The default value of a fromUTableValues[] section that is referenced
* _directly_ from a fromUStage3b[] item may also be UCNV_EXT_FROM_U_SUBCHAR1,
* but this value must not occur anywhere else in fromUTableValues[]
* because "no mapping" is always a property of a single code point,
* never of multiple.
*
*
* char fromUBytes[];
*

View file

@ -3026,7 +3026,9 @@ getTrail:
cnv->fromUnicodeStatus=prevLength; /* save the old state */
value=MBCS_VALUE_2_FROM_STAGE_2(bytes, stage2Entry, c);
if(value<=0xff) {
if(prevLength<=1) {
if(value==0 && MBCS_FROM_U_IS_ROUNDTRIP(stage2Entry, c)==0) {
/* no mapping, leave value==0 */
} else if(prevLength<=1) {
length=1;
} else {
/* change from double-byte mode to single-byte */