Skip to content

Commit ff2183b

Browse files
committed
Proper values for testing mbc codepoint length in EUC-JP.
1 parent 208f44f commit ff2183b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/org/jcodings/specific/BaseEUCJPEncoding.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,11 @@ public int codeToMbcLength(int code) {
4848
if ((code & 0xff0000) != 0) return 3;
4949
if ((code & 0xff00) != 0) return 2;
5050
} else {
51-
if (code > 0xffffff) return 0;
52-
if ((code & 0xff0000) >= 0x800000) return 3;
53-
if ((code & 0xff00) >= 0x8000) return 2;
51+
if (code > 0x00ffffff) {
52+
throw new EncodingException(ErrorMessages.ERR_TOO_BIG_WIDE_CHAR_VALUE);
53+
}
54+
else if ((code & 0xff808080) == 0x00808080) return 3;
55+
else if ((code & 0xffff8080) == 0x00008080) return 2;
5456
}
5557
throw new EncodingException(ErrorMessages.ERR_INVALID_CODE_POINT_VALUE);
5658
}

0 commit comments

Comments
 (0)