6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
4891024: EUC-KR and JOHAB converters need to be updated to include two new characters 4287467: Character converter generator tool Migrated some of the doublebyte charsets to the new implementation. Reviewed-by: okutsu
This commit is contained in:
parent
712e4baa4b
commit
721a90bda5
jdk
make
sun/nio
tools
src
share/classes/sun
io
ByteToCharEUC_CN.javaByteToCharEUC_KR.javaByteToCharGBK.javaByteToCharJohab.javaByteToCharMS932.javaByteToCharMS936.javaByteToCharMS949.javaByteToCharMS950.javaByteToCharMS950_HKSCS.javaCharToByteEUC_CN.javaCharToByteEUC_KR.javaCharToByteGBK.javaCharToByteJohab.javaCharToByteMS932.javaCharToByteMS932DB.javaCharToByteMS936.javaCharToByteMS949.javaCharToByteMS950.javaCharToByteMS950_HKSCS.java
nio/cs/ext
solaris/classes/sun/awt/motif
test/sun/nio/cs/OLD
@ -151,7 +151,6 @@ FILES_src = \
|
||||
sun/io/ByteToCharJISAutoDetect.java \
|
||||
sun/io/ByteToCharJohab.java \
|
||||
sun/io/ByteToCharMS874.java \
|
||||
sun/io/ByteToCharMS932DB.java \
|
||||
sun/io/ByteToCharMS932.java \
|
||||
sun/io/ByteToCharMS936.java \
|
||||
sun/io/ByteToCharMS949.java \
|
||||
@ -283,7 +282,6 @@ FILES_src = \
|
||||
sun/io/CharToByteISO8859_8.java \
|
||||
sun/io/CharToByteJohab.java \
|
||||
sun/io/CharToByteMS874.java \
|
||||
sun/io/CharToByteMS932DB.java \
|
||||
sun/io/CharToByteMS932.java \
|
||||
sun/io/CharToByteMS936.java \
|
||||
sun/io/CharToByteMS949.java \
|
||||
@ -388,7 +386,15 @@ FILES_gen_extcs = \
|
||||
sun/nio/cs/ext/IBM948.java \
|
||||
sun/nio/cs/ext/IBM949.java \
|
||||
sun/nio/cs/ext/IBM950.java \
|
||||
sun/nio/cs/ext/IBM970.java
|
||||
sun/nio/cs/ext/IBM970.java \
|
||||
sun/nio/cs/ext/EUC_CN.java \
|
||||
sun/nio/cs/ext/EUC_KR.java \
|
||||
sun/nio/cs/ext/Johab.java \
|
||||
sun/nio/cs/ext/MS932.java \
|
||||
sun/nio/cs/ext/MS936.java \
|
||||
sun/nio/cs/ext/MS949.java \
|
||||
sun/nio/cs/ext/MS950.java \
|
||||
sun/nio/cs/ext/GBK.java
|
||||
|
||||
FILES_java = $(FILES_src) $(FILES_gen_extcs)
|
||||
|
||||
|
@ -105,7 +105,7 @@ $(CLASSDESTDIR)/$(SERVICE_DESCRIPTION_PATH): \
|
||||
$(install-file)
|
||||
|
||||
$(CHARSETS_JAR): $(FILES_class) $(CLASSDESTDIR)/$(SERVICE_DESCRIPTION_PATH) $(FILES_DAT)
|
||||
$(BOOT_JAR_CMD) cf $(CHARSETS_JAR) \
|
||||
$(BOOT_JAR_CMD) cf0 $(CHARSETS_JAR) \
|
||||
-C $(CLASSDESTDIR) sun \
|
||||
-C $(CLASSDESTDIR) $(SERVICE_DESCRIPTION_PATH) \
|
||||
$(BOOT_JAR_JFLAGS)
|
||||
|
7578
jdk/make/tools/CharsetMapping/EUC_CN.map
Normal file
7578
jdk/make/tools/CharsetMapping/EUC_CN.map
Normal file
File diff suppressed because it is too large
Load Diff
8365
jdk/make/tools/CharsetMapping/EUC_KR.map
Normal file
8365
jdk/make/tools/CharsetMapping/EUC_KR.map
Normal file
File diff suppressed because it is too large
Load Diff
24074
jdk/make/tools/CharsetMapping/GBK.map
Normal file
24074
jdk/make/tools/CharsetMapping/GBK.map
Normal file
File diff suppressed because it is too large
Load Diff
17196
jdk/make/tools/CharsetMapping/Johab.map
Normal file
17196
jdk/make/tools/CharsetMapping/Johab.map
Normal file
File diff suppressed because it is too large
Load Diff
21
jdk/make/tools/CharsetMapping/MS932.c2b
Normal file
21
jdk/make/tools/CharsetMapping/MS932.c2b
Normal file
@ -0,0 +1,21 @@
|
||||
#
|
||||
# (1)entries that exist only in MS932DB.c2b.private
|
||||
# (diff result of MS932DB.b2c.private and MS932DB.c2b.private)
|
||||
# (2)added the jis0201 c->b only entries
|
||||
# u+203e -> 0x7e
|
||||
# u+00a5 -> 0x5c
|
||||
#
|
||||
0x7e 0x203e
|
||||
0x5c 0x00a5
|
||||
#
|
||||
0x8143 0x00b8 # CEDILLA
|
||||
0x8145 0x00b7 # MIDDLE DOT
|
||||
0x8150 0x00af # MACRON
|
||||
0x8191 0x00a2 # CENT SIGN
|
||||
0x8192 0x00a3 # POUND SIGN
|
||||
0x81ca 0x00ac # NOT SIGN
|
||||
0x81e1 0x00ab # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
|
||||
0x81e2 0x00bb # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
|
||||
0x8394 0x3094 # HIRAGANA LETTER VU
|
||||
0x83ca 0x00b5 # MICRO SIGN
|
||||
|
9809
jdk/make/tools/CharsetMapping/MS932.map
Normal file
9809
jdk/make/tools/CharsetMapping/MS932.map
Normal file
File diff suppressed because it is too large
Load Diff
402
jdk/make/tools/CharsetMapping/MS932.nr
Normal file
402
jdk/make/tools/CharsetMapping/MS932.nr
Normal file
@ -0,0 +1,402 @@
|
||||
#
|
||||
# These are the entries exist only in MS932DB.b2c.private
|
||||
# (diff result of MS932DB.b2c.private and MS932DB.c2b.private)
|
||||
#
|
||||
0x8790 0x2252 # APPROXIMATELY EQUAL TO OR THE IMAGE OF
|
||||
0x8791 0x2261 # IDENTICAL TO
|
||||
0x8792 0x222b # INTEGRAL
|
||||
0x8795 0x221a # SQUARE ROOT
|
||||
0x8796 0x22a5 # UP TACK
|
||||
0x8797 0x2220 # ANGLE
|
||||
0x879a 0x2235 # BECAUSE
|
||||
0x879b 0x2229 # INTERSECTION
|
||||
0x879c 0x222a # UNION
|
||||
0xed40 0x7e8a # CJK UNIFIED IDEOGRAPH-7E8A
|
||||
0xed41 0x891c # CJK UNIFIED IDEOGRAPH-891C
|
||||
0xed42 0x9348 # CJK UNIFIED IDEOGRAPH-9348
|
||||
0xed43 0x9288 # CJK UNIFIED IDEOGRAPH-9288
|
||||
0xed44 0x84dc # CJK UNIFIED IDEOGRAPH-84DC
|
||||
0xed45 0x4fc9 # CJK UNIFIED IDEOGRAPH-4FC9
|
||||
0xed46 0x70bb # CJK UNIFIED IDEOGRAPH-70BB
|
||||
0xed47 0x6631 # CJK UNIFIED IDEOGRAPH-6631
|
||||
0xed48 0x68c8 # CJK UNIFIED IDEOGRAPH-68C8
|
||||
0xed49 0x92f9 # CJK UNIFIED IDEOGRAPH-92F9
|
||||
0xed4a 0x66fb # CJK UNIFIED IDEOGRAPH-66FB
|
||||
0xed4b 0x5f45 # CJK UNIFIED IDEOGRAPH-5F45
|
||||
0xed4c 0x4e28 # CJK UNIFIED IDEOGRAPH-4E28
|
||||
0xed4d 0x4ee1 # CJK UNIFIED IDEOGRAPH-4EE1
|
||||
0xed4e 0x4efc # CJK UNIFIED IDEOGRAPH-4EFC
|
||||
0xed4f 0x4f00 # CJK UNIFIED IDEOGRAPH-4F00
|
||||
0xed50 0x4f03 # CJK UNIFIED IDEOGRAPH-4F03
|
||||
0xed51 0x4f39 # CJK UNIFIED IDEOGRAPH-4F39
|
||||
0xed52 0x4f56 # CJK UNIFIED IDEOGRAPH-4F56
|
||||
0xed53 0x4f92 # CJK UNIFIED IDEOGRAPH-4F92
|
||||
0xed54 0x4f8a # CJK UNIFIED IDEOGRAPH-4F8A
|
||||
0xed55 0x4f9a # CJK UNIFIED IDEOGRAPH-4F9A
|
||||
0xed56 0x4f94 # CJK UNIFIED IDEOGRAPH-4F94
|
||||
0xed57 0x4fcd # CJK UNIFIED IDEOGRAPH-4FCD
|
||||
0xed58 0x5040 # CJK UNIFIED IDEOGRAPH-5040
|
||||
0xed59 0x5022 # CJK UNIFIED IDEOGRAPH-5022
|
||||
0xed5a 0x4fff # CJK UNIFIED IDEOGRAPH-4FFF
|
||||
0xed5b 0x501e # CJK UNIFIED IDEOGRAPH-501E
|
||||
0xed5c 0x5046 # CJK UNIFIED IDEOGRAPH-5046
|
||||
0xed5d 0x5070 # CJK UNIFIED IDEOGRAPH-5070
|
||||
0xed5e 0x5042 # CJK UNIFIED IDEOGRAPH-5042
|
||||
0xed5f 0x5094 # CJK UNIFIED IDEOGRAPH-5094
|
||||
0xed60 0x50f4 # CJK UNIFIED IDEOGRAPH-50F4
|
||||
0xed61 0x50d8 # CJK UNIFIED IDEOGRAPH-50D8
|
||||
0xed62 0x514a # CJK UNIFIED IDEOGRAPH-514A
|
||||
0xed63 0x5164 # CJK UNIFIED IDEOGRAPH-5164
|
||||
0xed64 0x519d # CJK UNIFIED IDEOGRAPH-519D
|
||||
0xed65 0x51be # CJK UNIFIED IDEOGRAPH-51BE
|
||||
0xed66 0x51ec # CJK UNIFIED IDEOGRAPH-51EC
|
||||
0xed67 0x5215 # CJK UNIFIED IDEOGRAPH-5215
|
||||
0xed68 0x529c # CJK UNIFIED IDEOGRAPH-529C
|
||||
0xed69 0x52a6 # CJK UNIFIED IDEOGRAPH-52A6
|
||||
0xed6a 0x52c0 # CJK UNIFIED IDEOGRAPH-52C0
|
||||
0xed6b 0x52db # CJK UNIFIED IDEOGRAPH-52DB
|
||||
0xed6c 0x5300 # CJK UNIFIED IDEOGRAPH-5300
|
||||
0xed6d 0x5307 # CJK UNIFIED IDEOGRAPH-5307
|
||||
0xed6e 0x5324 # CJK UNIFIED IDEOGRAPH-5324
|
||||
0xed6f 0x5372 # CJK UNIFIED IDEOGRAPH-5372
|
||||
0xed70 0x5393 # CJK UNIFIED IDEOGRAPH-5393
|
||||
0xed71 0x53b2 # CJK UNIFIED IDEOGRAPH-53B2
|
||||
0xed72 0x53dd # CJK UNIFIED IDEOGRAPH-53DD
|
||||
0xed73 0xfa0e # CJK COMPATIBILITY IDEOGRAPH-FA0E
|
||||
0xed74 0x549c # CJK UNIFIED IDEOGRAPH-549C
|
||||
0xed75 0x548a # CJK UNIFIED IDEOGRAPH-548A
|
||||
0xed76 0x54a9 # CJK UNIFIED IDEOGRAPH-54A9
|
||||
0xed77 0x54ff # CJK UNIFIED IDEOGRAPH-54FF
|
||||
0xed78 0x5586 # CJK UNIFIED IDEOGRAPH-5586
|
||||
0xed79 0x5759 # CJK UNIFIED IDEOGRAPH-5759
|
||||
0xed7a 0x5765 # CJK UNIFIED IDEOGRAPH-5765
|
||||
0xed7b 0x57ac # CJK UNIFIED IDEOGRAPH-57AC
|
||||
0xed7c 0x57c8 # CJK UNIFIED IDEOGRAPH-57C8
|
||||
0xed7d 0x57c7 # CJK UNIFIED IDEOGRAPH-57C7
|
||||
0xed7e 0xfa0f # CJK COMPATIBILITY IDEOGRAPH-FA0F
|
||||
0xed80 0xfa10 # CJK COMPATIBILITY IDEOGRAPH-FA10
|
||||
0xed81 0x589e # CJK UNIFIED IDEOGRAPH-589E
|
||||
0xed82 0x58b2 # CJK UNIFIED IDEOGRAPH-58B2
|
||||
0xed83 0x590b # CJK UNIFIED IDEOGRAPH-590B
|
||||
0xed84 0x5953 # CJK UNIFIED IDEOGRAPH-5953
|
||||
0xed85 0x595b # CJK UNIFIED IDEOGRAPH-595B
|
||||
0xed86 0x595d # CJK UNIFIED IDEOGRAPH-595D
|
||||
0xed87 0x5963 # CJK UNIFIED IDEOGRAPH-5963
|
||||
0xed88 0x59a4 # CJK UNIFIED IDEOGRAPH-59A4
|
||||
0xed89 0x59ba # CJK UNIFIED IDEOGRAPH-59BA
|
||||
0xed8a 0x5b56 # CJK UNIFIED IDEOGRAPH-5B56
|
||||
0xed8b 0x5bc0 # CJK UNIFIED IDEOGRAPH-5BC0
|
||||
0xed8c 0x752f # CJK UNIFIED IDEOGRAPH-752F
|
||||
0xed8d 0x5bd8 # CJK UNIFIED IDEOGRAPH-5BD8
|
||||
0xed8e 0x5bec # CJK UNIFIED IDEOGRAPH-5BEC
|
||||
0xed8f 0x5c1e # CJK UNIFIED IDEOGRAPH-5C1E
|
||||
0xed90 0x5ca6 # CJK UNIFIED IDEOGRAPH-5CA6
|
||||
0xed91 0x5cba # CJK UNIFIED IDEOGRAPH-5CBA
|
||||
0xed92 0x5cf5 # CJK UNIFIED IDEOGRAPH-5CF5
|
||||
0xed93 0x5d27 # CJK UNIFIED IDEOGRAPH-5D27
|
||||
0xed94 0x5d53 # CJK UNIFIED IDEOGRAPH-5D53
|
||||
0xed95 0xfa11 # CJK COMPATIBILITY IDEOGRAPH-FA11
|
||||
0xed96 0x5d42 # CJK UNIFIED IDEOGRAPH-5D42
|
||||
0xed97 0x5d6d # CJK UNIFIED IDEOGRAPH-5D6D
|
||||
0xed98 0x5db8 # CJK UNIFIED IDEOGRAPH-5DB8
|
||||
0xed99 0x5db9 # CJK UNIFIED IDEOGRAPH-5DB9
|
||||
0xed9a 0x5dd0 # CJK UNIFIED IDEOGRAPH-5DD0
|
||||
0xed9b 0x5f21 # CJK UNIFIED IDEOGRAPH-5F21
|
||||
0xed9c 0x5f34 # CJK UNIFIED IDEOGRAPH-5F34
|
||||
0xed9d 0x5f67 # CJK UNIFIED IDEOGRAPH-5F67
|
||||
0xed9e 0x5fb7 # CJK UNIFIED IDEOGRAPH-5FB7
|
||||
0xed9f 0x5fde # CJK UNIFIED IDEOGRAPH-5FDE
|
||||
0xeda0 0x605d # CJK UNIFIED IDEOGRAPH-605D
|
||||
0xeda1 0x6085 # CJK UNIFIED IDEOGRAPH-6085
|
||||
0xeda2 0x608a # CJK UNIFIED IDEOGRAPH-608A
|
||||
0xeda3 0x60de # CJK UNIFIED IDEOGRAPH-60DE
|
||||
0xeda4 0x60d5 # CJK UNIFIED IDEOGRAPH-60D5
|
||||
0xeda5 0x6120 # CJK UNIFIED IDEOGRAPH-6120
|
||||
0xeda6 0x60f2 # CJK UNIFIED IDEOGRAPH-60F2
|
||||
0xeda7 0x6111 # CJK UNIFIED IDEOGRAPH-6111
|
||||
0xeda8 0x6137 # CJK UNIFIED IDEOGRAPH-6137
|
||||
0xeda9 0x6130 # CJK UNIFIED IDEOGRAPH-6130
|
||||
0xedaa 0x6198 # CJK UNIFIED IDEOGRAPH-6198
|
||||
0xedab 0x6213 # CJK UNIFIED IDEOGRAPH-6213
|
||||
0xedac 0x62a6 # CJK UNIFIED IDEOGRAPH-62A6
|
||||
0xedad 0x63f5 # CJK UNIFIED IDEOGRAPH-63F5
|
||||
0xedae 0x6460 # CJK UNIFIED IDEOGRAPH-6460
|
||||
0xedaf 0x649d # CJK UNIFIED IDEOGRAPH-649D
|
||||
0xedb0 0x64ce # CJK UNIFIED IDEOGRAPH-64CE
|
||||
0xedb1 0x654e # CJK UNIFIED IDEOGRAPH-654E
|
||||
0xedb2 0x6600 # CJK UNIFIED IDEOGRAPH-6600
|
||||
0xedb3 0x6615 # CJK UNIFIED IDEOGRAPH-6615
|
||||
0xedb4 0x663b # CJK UNIFIED IDEOGRAPH-663B
|
||||
0xedb5 0x6609 # CJK UNIFIED IDEOGRAPH-6609
|
||||
0xedb6 0x662e # CJK UNIFIED IDEOGRAPH-662E
|
||||
0xedb7 0x661e # CJK UNIFIED IDEOGRAPH-661E
|
||||
0xedb8 0x6624 # CJK UNIFIED IDEOGRAPH-6624
|
||||
0xedb9 0x6665 # CJK UNIFIED IDEOGRAPH-6665
|
||||
0xedba 0x6657 # CJK UNIFIED IDEOGRAPH-6657
|
||||
0xedbb 0x6659 # CJK UNIFIED IDEOGRAPH-6659
|
||||
0xedbc 0xfa12 # CJK COMPATIBILITY IDEOGRAPH-FA12
|
||||
0xedbd 0x6673 # CJK UNIFIED IDEOGRAPH-6673
|
||||
0xedbe 0x6699 # CJK UNIFIED IDEOGRAPH-6699
|
||||
0xedbf 0x66a0 # CJK UNIFIED IDEOGRAPH-66A0
|
||||
0xedc0 0x66b2 # CJK UNIFIED IDEOGRAPH-66B2
|
||||
0xedc1 0x66bf # CJK UNIFIED IDEOGRAPH-66BF
|
||||
0xedc2 0x66fa # CJK UNIFIED IDEOGRAPH-66FA
|
||||
0xedc3 0x670e # CJK UNIFIED IDEOGRAPH-670E
|
||||
0xedc4 0xf929 # CJK COMPATIBILITY IDEOGRAPH-F929
|
||||
0xedc5 0x6766 # CJK UNIFIED IDEOGRAPH-6766
|
||||
0xedc6 0x67bb # CJK UNIFIED IDEOGRAPH-67BB
|
||||
0xedc7 0x6852 # CJK UNIFIED IDEOGRAPH-6852
|
||||
0xedc8 0x67c0 # CJK UNIFIED IDEOGRAPH-67C0
|
||||
0xedc9 0x6801 # CJK UNIFIED IDEOGRAPH-6801
|
||||
0xedca 0x6844 # CJK UNIFIED IDEOGRAPH-6844
|
||||
0xedcb 0x68cf # CJK UNIFIED IDEOGRAPH-68CF
|
||||
0xedcc 0xfa13 # CJK COMPATIBILITY IDEOGRAPH-FA13
|
||||
0xedcd 0x6968 # CJK UNIFIED IDEOGRAPH-6968
|
||||
0xedce 0xfa14 # CJK COMPATIBILITY IDEOGRAPH-FA14
|
||||
0xedcf 0x6998 # CJK UNIFIED IDEOGRAPH-6998
|
||||
0xedd0 0x69e2 # CJK UNIFIED IDEOGRAPH-69E2
|
||||
0xedd1 0x6a30 # CJK UNIFIED IDEOGRAPH-6A30
|
||||
0xedd2 0x6a6b # CJK UNIFIED IDEOGRAPH-6A6B
|
||||
0xedd3 0x6a46 # CJK UNIFIED IDEOGRAPH-6A46
|
||||
0xedd4 0x6a73 # CJK UNIFIED IDEOGRAPH-6A73
|
||||
0xedd5 0x6a7e # CJK UNIFIED IDEOGRAPH-6A7E
|
||||
0xedd6 0x6ae2 # CJK UNIFIED IDEOGRAPH-6AE2
|
||||
0xedd7 0x6ae4 # CJK UNIFIED IDEOGRAPH-6AE4
|
||||
0xedd8 0x6bd6 # CJK UNIFIED IDEOGRAPH-6BD6
|
||||
0xedd9 0x6c3f # CJK UNIFIED IDEOGRAPH-6C3F
|
||||
0xedda 0x6c5c # CJK UNIFIED IDEOGRAPH-6C5C
|
||||
0xeddb 0x6c86 # CJK UNIFIED IDEOGRAPH-6C86
|
||||
0xeddc 0x6c6f # CJK UNIFIED IDEOGRAPH-6C6F
|
||||
0xeddd 0x6cda # CJK UNIFIED IDEOGRAPH-6CDA
|
||||
0xedde 0x6d04 # CJK UNIFIED IDEOGRAPH-6D04
|
||||
0xeddf 0x6d87 # CJK UNIFIED IDEOGRAPH-6D87
|
||||
0xede0 0x6d6f # CJK UNIFIED IDEOGRAPH-6D6F
|
||||
0xede1 0x6d96 # CJK UNIFIED IDEOGRAPH-6D96
|
||||
0xede2 0x6dac # CJK UNIFIED IDEOGRAPH-6DAC
|
||||
0xede3 0x6dcf # CJK UNIFIED IDEOGRAPH-6DCF
|
||||
0xede4 0x6df8 # CJK UNIFIED IDEOGRAPH-6DF8
|
||||
0xede5 0x6df2 # CJK UNIFIED IDEOGRAPH-6DF2
|
||||
0xede6 0x6dfc # CJK UNIFIED IDEOGRAPH-6DFC
|
||||
0xede7 0x6e39 # CJK UNIFIED IDEOGRAPH-6E39
|
||||
0xede8 0x6e5c # CJK UNIFIED IDEOGRAPH-6E5C
|
||||
0xede9 0x6e27 # CJK UNIFIED IDEOGRAPH-6E27
|
||||
0xedea 0x6e3c # CJK UNIFIED IDEOGRAPH-6E3C
|
||||
0xedeb 0x6ebf # CJK UNIFIED IDEOGRAPH-6EBF
|
||||
0xedec 0x6f88 # CJK UNIFIED IDEOGRAPH-6F88
|
||||
0xeded 0x6fb5 # CJK UNIFIED IDEOGRAPH-6FB5
|
||||
0xedee 0x6ff5 # CJK UNIFIED IDEOGRAPH-6FF5
|
||||
0xedef 0x7005 # CJK UNIFIED IDEOGRAPH-7005
|
||||
0xedf0 0x7007 # CJK UNIFIED IDEOGRAPH-7007
|
||||
0xedf1 0x7028 # CJK UNIFIED IDEOGRAPH-7028
|
||||
0xedf2 0x7085 # CJK UNIFIED IDEOGRAPH-7085
|
||||
0xedf3 0x70ab # CJK UNIFIED IDEOGRAPH-70AB
|
||||
0xedf4 0x710f # CJK UNIFIED IDEOGRAPH-710F
|
||||
0xedf5 0x7104 # CJK UNIFIED IDEOGRAPH-7104
|
||||
0xedf6 0x715c # CJK UNIFIED IDEOGRAPH-715C
|
||||
0xedf7 0x7146 # CJK UNIFIED IDEOGRAPH-7146
|
||||
0xedf8 0x7147 # CJK UNIFIED IDEOGRAPH-7147
|
||||
0xedf9 0xfa15 # CJK COMPATIBILITY IDEOGRAPH-FA15
|
||||
0xedfa 0x71c1 # CJK UNIFIED IDEOGRAPH-71C1
|
||||
0xedfb 0x71fe # CJK UNIFIED IDEOGRAPH-71FE
|
||||
0xedfc 0x72b1 # CJK UNIFIED IDEOGRAPH-72B1
|
||||
0xee40 0x72be # CJK UNIFIED IDEOGRAPH-72BE
|
||||
0xee41 0x7324 # CJK UNIFIED IDEOGRAPH-7324
|
||||
0xee42 0xfa16 # CJK COMPATIBILITY IDEOGRAPH-FA16
|
||||
0xee43 0x7377 # CJK UNIFIED IDEOGRAPH-7377
|
||||
0xee44 0x73bd # CJK UNIFIED IDEOGRAPH-73BD
|
||||
0xee45 0x73c9 # CJK UNIFIED IDEOGRAPH-73C9
|
||||
0xee46 0x73d6 # CJK UNIFIED IDEOGRAPH-73D6
|
||||
0xee47 0x73e3 # CJK UNIFIED IDEOGRAPH-73E3
|
||||
0xee48 0x73d2 # CJK UNIFIED IDEOGRAPH-73D2
|
||||
0xee49 0x7407 # CJK UNIFIED IDEOGRAPH-7407
|
||||
0xee4a 0x73f5 # CJK UNIFIED IDEOGRAPH-73F5
|
||||
0xee4b 0x7426 # CJK UNIFIED IDEOGRAPH-7426
|
||||
0xee4c 0x742a # CJK UNIFIED IDEOGRAPH-742A
|
||||
0xee4d 0x7429 # CJK UNIFIED IDEOGRAPH-7429
|
||||
0xee4e 0x742e # CJK UNIFIED IDEOGRAPH-742E
|
||||
0xee4f 0x7462 # CJK UNIFIED IDEOGRAPH-7462
|
||||
0xee50 0x7489 # CJK UNIFIED IDEOGRAPH-7489
|
||||
0xee51 0x749f # CJK UNIFIED IDEOGRAPH-749F
|
||||
0xee52 0x7501 # CJK UNIFIED IDEOGRAPH-7501
|
||||
0xee53 0x756f # CJK UNIFIED IDEOGRAPH-756F
|
||||
0xee54 0x7682 # CJK UNIFIED IDEOGRAPH-7682
|
||||
0xee55 0x769c # CJK UNIFIED IDEOGRAPH-769C
|
||||
0xee56 0x769e # CJK UNIFIED IDEOGRAPH-769E
|
||||
0xee57 0x769b # CJK UNIFIED IDEOGRAPH-769B
|
||||
0xee58 0x76a6 # CJK UNIFIED IDEOGRAPH-76A6
|
||||
0xee59 0xfa17 # CJK COMPATIBILITY IDEOGRAPH-FA17
|
||||
0xee5a 0x7746 # CJK UNIFIED IDEOGRAPH-7746
|
||||
0xee5b 0x52af # CJK UNIFIED IDEOGRAPH-52AF
|
||||
0xee5c 0x7821 # CJK UNIFIED IDEOGRAPH-7821
|
||||
0xee5d 0x784e # CJK UNIFIED IDEOGRAPH-784E
|
||||
0xee5e 0x7864 # CJK UNIFIED IDEOGRAPH-7864
|
||||
0xee5f 0x787a # CJK UNIFIED IDEOGRAPH-787A
|
||||
0xee60 0x7930 # CJK UNIFIED IDEOGRAPH-7930
|
||||
0xee61 0xfa18 # CJK COMPATIBILITY IDEOGRAPH-FA18
|
||||
0xee62 0xfa19 # CJK COMPATIBILITY IDEOGRAPH-FA19
|
||||
0xee63 0xfa1a # CJK COMPATIBILITY IDEOGRAPH-FA1A
|
||||
0xee64 0x7994 # CJK UNIFIED IDEOGRAPH-7994
|
||||
0xee65 0xfa1b # CJK COMPATIBILITY IDEOGRAPH-FA1B
|
||||
0xee66 0x799b # CJK UNIFIED IDEOGRAPH-799B
|
||||
0xee67 0x7ad1 # CJK UNIFIED IDEOGRAPH-7AD1
|
||||
0xee68 0x7ae7 # CJK UNIFIED IDEOGRAPH-7AE7
|
||||
0xee69 0xfa1c # CJK COMPATIBILITY IDEOGRAPH-FA1C
|
||||
0xee6a 0x7aeb # CJK UNIFIED IDEOGRAPH-7AEB
|
||||
0xee6b 0x7b9e # CJK UNIFIED IDEOGRAPH-7B9E
|
||||
0xee6c 0xfa1d # CJK COMPATIBILITY IDEOGRAPH-FA1D
|
||||
0xee6d 0x7d48 # CJK UNIFIED IDEOGRAPH-7D48
|
||||
0xee6e 0x7d5c # CJK UNIFIED IDEOGRAPH-7D5C
|
||||
0xee6f 0x7db7 # CJK UNIFIED IDEOGRAPH-7DB7
|
||||
0xee70 0x7da0 # CJK UNIFIED IDEOGRAPH-7DA0
|
||||
0xee71 0x7dd6 # CJK UNIFIED IDEOGRAPH-7DD6
|
||||
0xee72 0x7e52 # CJK UNIFIED IDEOGRAPH-7E52
|
||||
0xee73 0x7f47 # CJK UNIFIED IDEOGRAPH-7F47
|
||||
0xee74 0x7fa1 # CJK UNIFIED IDEOGRAPH-7FA1
|
||||
0xee75 0xfa1e # CJK COMPATIBILITY IDEOGRAPH-FA1E
|
||||
0xee76 0x8301 # CJK UNIFIED IDEOGRAPH-8301
|
||||
0xee77 0x8362 # CJK UNIFIED IDEOGRAPH-8362
|
||||
0xee78 0x837f # CJK UNIFIED IDEOGRAPH-837F
|
||||
0xee79 0x83c7 # CJK UNIFIED IDEOGRAPH-83C7
|
||||
0xee7a 0x83f6 # CJK UNIFIED IDEOGRAPH-83F6
|
||||
0xee7b 0x8448 # CJK UNIFIED IDEOGRAPH-8448
|
||||
0xee7c 0x84b4 # CJK UNIFIED IDEOGRAPH-84B4
|
||||
0xee7d 0x8553 # CJK UNIFIED IDEOGRAPH-8553
|
||||
0xee7e 0x8559 # CJK UNIFIED IDEOGRAPH-8559
|
||||
0xee80 0x856b # CJK UNIFIED IDEOGRAPH-856B
|
||||
0xee81 0xfa1f # CJK COMPATIBILITY IDEOGRAPH-FA1F
|
||||
0xee82 0x85b0 # CJK UNIFIED IDEOGRAPH-85B0
|
||||
0xee83 0xfa20 # CJK COMPATIBILITY IDEOGRAPH-FA20
|
||||
0xee84 0xfa21 # CJK COMPATIBILITY IDEOGRAPH-FA21
|
||||
0xee85 0x8807 # CJK UNIFIED IDEOGRAPH-8807
|
||||
0xee86 0x88f5 # CJK UNIFIED IDEOGRAPH-88F5
|
||||
0xee87 0x8a12 # CJK UNIFIED IDEOGRAPH-8A12
|
||||
0xee88 0x8a37 # CJK UNIFIED IDEOGRAPH-8A37
|
||||
0xee89 0x8a79 # CJK UNIFIED IDEOGRAPH-8A79
|
||||
0xee8a 0x8aa7 # CJK UNIFIED IDEOGRAPH-8AA7
|
||||
0xee8b 0x8abe # CJK UNIFIED IDEOGRAPH-8ABE
|
||||
0xee8c 0x8adf # CJK UNIFIED IDEOGRAPH-8ADF
|
||||
0xee8d 0xfa22 # CJK COMPATIBILITY IDEOGRAPH-FA22
|
||||
0xee8e 0x8af6 # CJK UNIFIED IDEOGRAPH-8AF6
|
||||
0xee8f 0x8b53 # CJK UNIFIED IDEOGRAPH-8B53
|
||||
0xee90 0x8b7f # CJK UNIFIED IDEOGRAPH-8B7F
|
||||
0xee91 0x8cf0 # CJK UNIFIED IDEOGRAPH-8CF0
|
||||
0xee92 0x8cf4 # CJK UNIFIED IDEOGRAPH-8CF4
|
||||
0xee93 0x8d12 # CJK UNIFIED IDEOGRAPH-8D12
|
||||
0xee94 0x8d76 # CJK UNIFIED IDEOGRAPH-8D76
|
||||
0xee95 0xfa23 # CJK COMPATIBILITY IDEOGRAPH-FA23
|
||||
0xee96 0x8ecf # CJK UNIFIED IDEOGRAPH-8ECF
|
||||
0xee97 0xfa24 # CJK COMPATIBILITY IDEOGRAPH-FA24
|
||||
0xee98 0xfa25 # CJK COMPATIBILITY IDEOGRAPH-FA25
|
||||
0xee99 0x9067 # CJK UNIFIED IDEOGRAPH-9067
|
||||
0xee9a 0x90de # CJK UNIFIED IDEOGRAPH-90DE
|
||||
0xee9b 0xfa26 # CJK COMPATIBILITY IDEOGRAPH-FA26
|
||||
0xee9c 0x9115 # CJK UNIFIED IDEOGRAPH-9115
|
||||
0xee9d 0x9127 # CJK UNIFIED IDEOGRAPH-9127
|
||||
0xee9e 0x91da # CJK UNIFIED IDEOGRAPH-91DA
|
||||
0xee9f 0x91d7 # CJK UNIFIED IDEOGRAPH-91D7
|
||||
0xeea0 0x91de # CJK UNIFIED IDEOGRAPH-91DE
|
||||
0xeea1 0x91ed # CJK UNIFIED IDEOGRAPH-91ED
|
||||
0xeea2 0x91ee # CJK UNIFIED IDEOGRAPH-91EE
|
||||
0xeea3 0x91e4 # CJK UNIFIED IDEOGRAPH-91E4
|
||||
0xeea4 0x91e5 # CJK UNIFIED IDEOGRAPH-91E5
|
||||
0xeea5 0x9206 # CJK UNIFIED IDEOGRAPH-9206
|
||||
0xeea6 0x9210 # CJK UNIFIED IDEOGRAPH-9210
|
||||
0xeea7 0x920a # CJK UNIFIED IDEOGRAPH-920A
|
||||
0xeea8 0x923a # CJK UNIFIED IDEOGRAPH-923A
|
||||
0xeea9 0x9240 # CJK UNIFIED IDEOGRAPH-9240
|
||||
0xeeaa 0x923c # CJK UNIFIED IDEOGRAPH-923C
|
||||
0xeeab 0x924e # CJK UNIFIED IDEOGRAPH-924E
|
||||
0xeeac 0x9259 # CJK UNIFIED IDEOGRAPH-9259
|
||||
0xeead 0x9251 # CJK UNIFIED IDEOGRAPH-9251
|
||||
0xeeae 0x9239 # CJK UNIFIED IDEOGRAPH-9239
|
||||
0xeeaf 0x9267 # CJK UNIFIED IDEOGRAPH-9267
|
||||
0xeeb0 0x92a7 # CJK UNIFIED IDEOGRAPH-92A7
|
||||
0xeeb1 0x9277 # CJK UNIFIED IDEOGRAPH-9277
|
||||
0xeeb2 0x9278 # CJK UNIFIED IDEOGRAPH-9278
|
||||
0xeeb3 0x92e7 # CJK UNIFIED IDEOGRAPH-92E7
|
||||
0xeeb4 0x92d7 # CJK UNIFIED IDEOGRAPH-92D7
|
||||
0xeeb5 0x92d9 # CJK UNIFIED IDEOGRAPH-92D9
|
||||
0xeeb6 0x92d0 # CJK UNIFIED IDEOGRAPH-92D0
|
||||
0xeeb7 0xfa27 # CJK COMPATIBILITY IDEOGRAPH-FA27
|
||||
0xeeb8 0x92d5 # CJK UNIFIED IDEOGRAPH-92D5
|
||||
0xeeb9 0x92e0 # CJK UNIFIED IDEOGRAPH-92E0
|
||||
0xeeba 0x92d3 # CJK UNIFIED IDEOGRAPH-92D3
|
||||
0xeebb 0x9325 # CJK UNIFIED IDEOGRAPH-9325
|
||||
0xeebc 0x9321 # CJK UNIFIED IDEOGRAPH-9321
|
||||
0xeebd 0x92fb # CJK UNIFIED IDEOGRAPH-92FB
|
||||
0xeebe 0xfa28 # CJK COMPATIBILITY IDEOGRAPH-FA28
|
||||
0xeebf 0x931e # CJK UNIFIED IDEOGRAPH-931E
|
||||
0xeec0 0x92ff # CJK UNIFIED IDEOGRAPH-92FF
|
||||
0xeec1 0x931d # CJK UNIFIED IDEOGRAPH-931D
|
||||
0xeec2 0x9302 # CJK UNIFIED IDEOGRAPH-9302
|
||||
0xeec3 0x9370 # CJK UNIFIED IDEOGRAPH-9370
|
||||
0xeec4 0x9357 # CJK UNIFIED IDEOGRAPH-9357
|
||||
0xeec5 0x93a4 # CJK UNIFIED IDEOGRAPH-93A4
|
||||
0xeec6 0x93c6 # CJK UNIFIED IDEOGRAPH-93C6
|
||||
0xeec7 0x93de # CJK UNIFIED IDEOGRAPH-93DE
|
||||
0xeec8 0x93f8 # CJK UNIFIED IDEOGRAPH-93F8
|
||||
0xeec9 0x9431 # CJK UNIFIED IDEOGRAPH-9431
|
||||
0xeeca 0x9445 # CJK UNIFIED IDEOGRAPH-9445
|
||||
0xeecb 0x9448 # CJK UNIFIED IDEOGRAPH-9448
|
||||
0xeecc 0x9592 # CJK UNIFIED IDEOGRAPH-9592
|
||||
0xeecd 0xf9dc # CJK COMPATIBILITY IDEOGRAPH-F9DC
|
||||
0xeece 0xfa29 # CJK COMPATIBILITY IDEOGRAPH-FA29
|
||||
0xeecf 0x969d # CJK UNIFIED IDEOGRAPH-969D
|
||||
0xeed0 0x96af # CJK UNIFIED IDEOGRAPH-96AF
|
||||
0xeed1 0x9733 # CJK UNIFIED IDEOGRAPH-9733
|
||||
0xeed2 0x973b # CJK UNIFIED IDEOGRAPH-973B
|
||||
0xeed3 0x9743 # CJK UNIFIED IDEOGRAPH-9743
|
||||
0xeed4 0x974d # CJK UNIFIED IDEOGRAPH-974D
|
||||
0xeed5 0x974f # CJK UNIFIED IDEOGRAPH-974F
|
||||
0xeed6 0x9751 # CJK UNIFIED IDEOGRAPH-9751
|
||||
0xeed7 0x9755 # CJK UNIFIED IDEOGRAPH-9755
|
||||
0xeed8 0x9857 # CJK UNIFIED IDEOGRAPH-9857
|
||||
0xeed9 0x9865 # CJK UNIFIED IDEOGRAPH-9865
|
||||
0xeeda 0xfa2a # CJK COMPATIBILITY IDEOGRAPH-FA2A
|
||||
0xeedb 0xfa2b # CJK COMPATIBILITY IDEOGRAPH-FA2B
|
||||
0xeedc 0x9927 # CJK UNIFIED IDEOGRAPH-9927
|
||||
0xeedd 0xfa2c # CJK COMPATIBILITY IDEOGRAPH-FA2C
|
||||
0xeede 0x999e # CJK UNIFIED IDEOGRAPH-999E
|
||||
0xeedf 0x9a4e # CJK UNIFIED IDEOGRAPH-9A4E
|
||||
0xeee0 0x9ad9 # CJK UNIFIED IDEOGRAPH-9AD9
|
||||
0xeee1 0x9adc # CJK UNIFIED IDEOGRAPH-9ADC
|
||||
0xeee2 0x9b75 # CJK UNIFIED IDEOGRAPH-9B75
|
||||
0xeee3 0x9b72 # CJK UNIFIED IDEOGRAPH-9B72
|
||||
0xeee4 0x9b8f # CJK UNIFIED IDEOGRAPH-9B8F
|
||||
0xeee5 0x9bb1 # CJK UNIFIED IDEOGRAPH-9BB1
|
||||
0xeee6 0x9bbb # CJK UNIFIED IDEOGRAPH-9BBB
|
||||
0xeee7 0x9c00 # CJK UNIFIED IDEOGRAPH-9C00
|
||||
0xeee8 0x9d70 # CJK UNIFIED IDEOGRAPH-9D70
|
||||
0xeee9 0x9d6b # CJK UNIFIED IDEOGRAPH-9D6B
|
||||
0xeeea 0xfa2d # CJK COMPATIBILITY IDEOGRAPH-FA2D
|
||||
0xeeeb 0x9e19 # CJK UNIFIED IDEOGRAPH-9E19
|
||||
0xeeec 0x9ed1 # CJK UNIFIED IDEOGRAPH-9ED1
|
||||
0xeeef 0x2170 # SMALL ROMAN NUMERAL ONE
|
||||
0xeef0 0x2171 # SMALL ROMAN NUMERAL TWO
|
||||
0xeef1 0x2172 # SMALL ROMAN NUMERAL THREE
|
||||
0xeef2 0x2173 # SMALL ROMAN NUMERAL FOUR
|
||||
0xeef3 0x2174 # SMALL ROMAN NUMERAL FIVE
|
||||
0xeef4 0x2175 # SMALL ROMAN NUMERAL SIX
|
||||
0xeef5 0x2176 # SMALL ROMAN NUMERAL SEVEN
|
||||
0xeef6 0x2177 # SMALL ROMAN NUMERAL EIGHT
|
||||
0xeef7 0x2178 # SMALL ROMAN NUMERAL NINE
|
||||
0xeef8 0x2179 # SMALL ROMAN NUMERAL TEN
|
||||
0xeef9 0xffe2 # FULLWIDTH NOT SIGN
|
||||
0xeefa 0xffe4 # FULLWIDTH BROKEN BAR
|
||||
0xeefb 0xff07 # FULLWIDTH APOSTROPHE
|
||||
0xeefc 0xff02 # FULLWIDTH QUOTATION MARK
|
||||
0xfa4a 0x2160 # ROMAN NUMERAL ONE
|
||||
0xfa4b 0x2161 # ROMAN NUMERAL TWO
|
||||
0xfa4c 0x2162 # ROMAN NUMERAL THREE
|
||||
0xfa4d 0x2163 # ROMAN NUMERAL FOUR
|
||||
0xfa4e 0x2164 # ROMAN NUMERAL FIVE
|
||||
0xfa4f 0x2165 # ROMAN NUMERAL SIX
|
||||
0xfa50 0x2166 # ROMAN NUMERAL SEVEN
|
||||
0xfa51 0x2167 # ROMAN NUMERAL EIGHT
|
||||
0xfa52 0x2168 # ROMAN NUMERAL NINE
|
||||
0xfa53 0x2169 # ROMAN NUMERAL TEN
|
||||
0xfa54 0xffe2 # FULLWIDTH NOT SIGN
|
||||
0xfa58 0x3231 # PARENTHESIZED IDEOGRAPH STOCK
|
||||
0xfa59 0x2116 # NUMERO SIGN
|
||||
0xfa5a 0x2121 # TELEPHONE SIGN
|
||||
0xfa5b 0x2235 # BECAUSE
|
24099
jdk/make/tools/CharsetMapping/MS936.map
Normal file
24099
jdk/make/tools/CharsetMapping/MS936.map
Normal file
File diff suppressed because it is too large
Load Diff
17384
jdk/make/tools/CharsetMapping/MS949.map
Normal file
17384
jdk/make/tools/CharsetMapping/MS949.map
Normal file
File diff suppressed because it is too large
Load Diff
19886
jdk/make/tools/CharsetMapping/MS950.map
Normal file
19886
jdk/make/tools/CharsetMapping/MS950.map
Normal file
File diff suppressed because it is too large
Load Diff
18
jdk/make/tools/CharsetMapping/MS950.nr
Normal file
18
jdk/make/tools/CharsetMapping/MS950.nr
Normal file
@ -0,0 +1,18 @@
|
||||
#
|
||||
# copy/paste of MS950.b2c-irreversible
|
||||
#
|
||||
# removed the entries of MS950.c2b-irreversible etries, this .nr
|
||||
# table only includes "b->c only" entries
|
||||
# (we don't need a MS950.c2b, the entries of MS950.c2b-irreversible
|
||||
# are added in MS950.b2c already)
|
||||
#
|
||||
0xF9FA 0x256D
|
||||
0xF9FB 0x256E
|
||||
0xF9FC 0x2570
|
||||
0xF9FD 0x256F
|
||||
0xA2CC 0x5341
|
||||
0xA2CE 0x5345
|
||||
0xF9F9 0x2550
|
||||
0xF9E9 0x255E
|
||||
0xF9EA 0x256A
|
||||
0xF9EB 0x2561
|
@ -1,6 +1,14 @@
|
||||
#
|
||||
#clzName csName hisName dbtype pkg ascii b1min b1max b2min b2max
|
||||
#
|
||||
Johab x-Johab x-Johab basic sun.nio.cs.ext true 0x84 0xf9 0x31 0xfe
|
||||
EUC_CN GB2312 EUC_CN basic sun.nio.cs.ext true 0xa1 0xf7 0xa1 0xfe
|
||||
EUC_KR EUC-KR EUC_KR basic sun.nio.cs.ext true 0xa1 0xfd 0xa1 0xfe
|
||||
MS932 windows-31j MS932 basic sun.nio.cs.ext true 0x81 0xfc 0x40 0xfc
|
||||
MS936 x-mswin-936 MS936 basic sun.nio.cs.ext true 0x81 0xfe 0x40 0xfe
|
||||
MS949 x-windows-949 MS949 basic sun.nio.cs.ext true 0x81 0xfe 0x41 0xfe
|
||||
MS950 x-windows-950 MS950 basic sun.nio.cs.ext true 0x81 0xfe 0x40 0xfe
|
||||
GBK GBK GBK basic sun.nio.cs.ext true 0x81 0xfe 0x40 0xfe
|
||||
IBM1381 x-IBM1381 Cp1381 basic sun.nio.cs.ext true 0x8c 0xf7 0xa1 0xfe
|
||||
IBM1383 x-IBM1383 Cp1383 euc_sim sun.nio.cs.ext true 0xa1 0xfe 0xa1 0xfe
|
||||
IBM930 x-IBM930 Cp930 ebcdic sun.nio.cs.ext false 0x40 0x7f 0x40 0xfe
|
||||
|
@ -35,7 +35,7 @@ import static build.tools.charsetmapping.CharsetMapping.*;
|
||||
|
||||
public class GenerateDBCS {
|
||||
// pattern used by this class to read in mapping table
|
||||
static Pattern mPattern = Pattern.compile("(\\p{XDigit}++)\\s++(\\p{XDigit}++)(\\s++#.*)?");
|
||||
static Pattern mPattern = Pattern.compile("(?:0x)?(\\p{XDigit}++)\\s++(?:0x)?(\\p{XDigit}++)(?:\\s++#.*)?");
|
||||
public static void genDBCS(String args[]) throws Exception {
|
||||
|
||||
Scanner s = new Scanner(new File(args[0], args[2]));
|
||||
@ -260,10 +260,12 @@ public class GenerateDBCS {
|
||||
"StandardCharsets.aliases_" + clzName :
|
||||
"ExtendedCharsets.aliasesFor(\"" + csName + "\")")
|
||||
.replace("$NAME_CS$" , csName)
|
||||
.replace("$CONTAINS$", isASCII ?
|
||||
" return ((cs.name().equals(\"US-ASCII\")) || (cs instanceof "
|
||||
+ clzName + "));":
|
||||
" return (cs instanceof " + clzName + ");")
|
||||
.replace("$CONTAINS$",
|
||||
"MS932".equals(clzName)?
|
||||
"return ((cs.name().equals(\"US-ASCII\")) || (cs instanceof JIS_X_0201) || (cs instanceof " + clzName + "));":
|
||||
(isASCII ?
|
||||
"return ((cs.name().equals(\"US-ASCII\")) || (cs instanceof " + clzName + "));":
|
||||
"return (cs instanceof " + clzName + ");"))
|
||||
.replace("$HISTORICALNAME$",
|
||||
(hisName == null)? "" :
|
||||
" public String historicalName() { return \"" + hisName + "\"; }")
|
||||
|
@ -25,26 +25,18 @@
|
||||
|
||||
package sun.io;
|
||||
|
||||
import sun.nio.cs.ext.EUC_CN;
|
||||
import sun.nio.cs.ext.*;
|
||||
|
||||
/**
|
||||
* Tables and data to convert EUC_CN to Unicode
|
||||
*
|
||||
* @author ConverterGenerator tool
|
||||
*/
|
||||
public class ByteToCharEUC_CN extends ByteToCharDBCS_ASCII {
|
||||
|
||||
public class ByteToCharEUC_CN extends ByteToCharDoubleByte {
|
||||
|
||||
private EUC_CN nioCoder = new EUC_CN();
|
||||
private static DoubleByte.Decoder dec =
|
||||
(DoubleByte.Decoder)new EUC_CN().newDecoder();
|
||||
|
||||
public String getCharacterEncoding() {
|
||||
return "EUC_CN";
|
||||
}
|
||||
|
||||
public ByteToCharEUC_CN() {
|
||||
super.index1 = nioCoder.getDecoderIndex1();
|
||||
super.index2 = nioCoder.getDecoderIndex2();
|
||||
start = 0xA1;
|
||||
end = 0xFE;
|
||||
super(dec);
|
||||
}
|
||||
}
|
||||
|
@ -26,26 +26,18 @@
|
||||
|
||||
package sun.io;
|
||||
|
||||
import sun.nio.cs.ext.EUC_KR;
|
||||
import sun.nio.cs.ext.*;
|
||||
|
||||
/**
|
||||
* Tables and data to convert EUC_KR to Unicode
|
||||
*
|
||||
* @author ConverterGenerator tool
|
||||
*/
|
||||
public class ByteToCharEUC_KR extends ByteToCharDBCS_ASCII {
|
||||
|
||||
public class ByteToCharEUC_KR extends ByteToCharDoubleByte {
|
||||
|
||||
private final static EUC_KR nioCoder = new EUC_KR();
|
||||
private static DoubleByte.Decoder dec =
|
||||
(DoubleByte.Decoder)new EUC_KR().newDecoder();
|
||||
|
||||
public String getCharacterEncoding() {
|
||||
return "EUC_KR";
|
||||
}
|
||||
|
||||
public ByteToCharEUC_KR() {
|
||||
super.index1 = nioCoder.getDecoderIndex1();
|
||||
super.index2 = nioCoder.getDecoderIndex2();
|
||||
start = 0xA1;
|
||||
end = 0xFE;
|
||||
super(dec);
|
||||
}
|
||||
}
|
||||
|
@ -26,26 +26,18 @@
|
||||
|
||||
package sun.io;
|
||||
|
||||
import sun.nio.cs.ext.GBK;
|
||||
import sun.nio.cs.ext.*;
|
||||
|
||||
/**
|
||||
* Tables and data to convert GBK to Unicode
|
||||
*
|
||||
* @author ConverterGenerator tool
|
||||
*/
|
||||
public class ByteToCharGBK extends ByteToCharDBCS_ASCII {
|
||||
|
||||
public class ByteToCharGBK extends ByteToCharDoubleByte {
|
||||
|
||||
private final static GBK nioCoder = new GBK();
|
||||
private static DoubleByte.Decoder dec =
|
||||
(DoubleByte.Decoder)new GBK().newDecoder();
|
||||
|
||||
public String getCharacterEncoding() {
|
||||
return "GBK";
|
||||
}
|
||||
|
||||
public ByteToCharGBK() {
|
||||
super.index1 = nioCoder.getDecoderIndex1();
|
||||
super.index2 = nioCoder.getDecoderIndex2();
|
||||
start = 0x40;
|
||||
end = 0xFE;
|
||||
super(dec);
|
||||
}
|
||||
}
|
||||
|
@ -26,26 +26,18 @@
|
||||
|
||||
package sun.io;
|
||||
|
||||
import sun.nio.cs.ext.Johab;
|
||||
import sun.nio.cs.ext.*;
|
||||
|
||||
/**
|
||||
* Tables and data to convert Johab to Unicode
|
||||
*
|
||||
* @author ConverterGenerator tool
|
||||
*/
|
||||
public class ByteToCharJohab extends ByteToCharDBCS_ASCII {
|
||||
|
||||
public class ByteToCharJohab extends ByteToCharDoubleByte {
|
||||
|
||||
private final static Johab nioCoder = new Johab();
|
||||
private static DoubleByte.Decoder dec =
|
||||
(DoubleByte.Decoder)new Johab().newDecoder();
|
||||
|
||||
public String getCharacterEncoding() {
|
||||
return "Johab";
|
||||
}
|
||||
|
||||
public ByteToCharJohab() {
|
||||
super.index1 = nioCoder.getDecoderIndex1();
|
||||
super.index2 = nioCoder.getDecoderIndex2();
|
||||
start = 0x20;
|
||||
end = 0xFE;
|
||||
super(dec);
|
||||
}
|
||||
}
|
||||
|
@ -25,29 +25,19 @@
|
||||
|
||||
package sun.io;
|
||||
|
||||
/**
|
||||
* Tables and data to convert MS932 to Unicode
|
||||
*
|
||||
* @author Limin Shi
|
||||
* @author Mark Son-Bell
|
||||
*/
|
||||
import sun.nio.cs.ext.*;
|
||||
|
||||
public class ByteToCharMS932 extends ByteToCharMS932DB {
|
||||
ByteToCharJIS0201 bcJIS0201 = new ByteToCharJIS0201();
|
||||
public class ByteToCharMS932 extends ByteToCharDBCS_ASCII {
|
||||
|
||||
private static DoubleByte.Decoder dec =
|
||||
(DoubleByte.Decoder)new MS932().newDecoder();
|
||||
|
||||
public String getCharacterEncoding() {
|
||||
return "MS932";
|
||||
}
|
||||
|
||||
protected char convSingleByte(int b) {
|
||||
// If the high bits are all off, it's ASCII == Unicode
|
||||
if ((b & 0xFF80) == 0) {
|
||||
return (char)b;
|
||||
}
|
||||
return bcJIS0201.getUnicode(b);
|
||||
public ByteToCharMS932() {
|
||||
super(dec);
|
||||
}
|
||||
|
||||
String prt(int i) {
|
||||
return Integer.toString(i,16);
|
||||
}
|
||||
}
|
||||
|
@ -25,26 +25,18 @@
|
||||
|
||||
package sun.io;
|
||||
|
||||
import sun.nio.cs.ext.MS936;
|
||||
import sun.nio.cs.ext.*;
|
||||
|
||||
/**
|
||||
* Tables and data to convert MS936 to Unicode
|
||||
*
|
||||
* @author ConverterGenerator tool
|
||||
*/
|
||||
public class ByteToCharMS936 extends ByteToCharDBCS_ASCII {
|
||||
|
||||
public class ByteToCharMS936 extends ByteToCharDoubleByte {
|
||||
|
||||
private final static MS936 nioCoder = new MS936();
|
||||
private static DoubleByte.Decoder dec =
|
||||
(DoubleByte.Decoder)new MS936().newDecoder();
|
||||
|
||||
public String getCharacterEncoding() {
|
||||
return "MS936";
|
||||
}
|
||||
|
||||
public ByteToCharMS936() {
|
||||
super.index1 = nioCoder.getDecoderIndex1();
|
||||
super.index2 = nioCoder.getDecoderIndex2();
|
||||
start = 0x40;
|
||||
end = 0xFE;
|
||||
super(dec);
|
||||
}
|
||||
}
|
||||
|
@ -26,25 +26,19 @@
|
||||
|
||||
package sun.io;
|
||||
|
||||
import sun.nio.cs.ext.MS949;
|
||||
import sun.nio.cs.ext.*;
|
||||
|
||||
/**
|
||||
* Tables and data to convert MS949 to Unicode
|
||||
*
|
||||
* @author ConverterGenerator tool
|
||||
*/
|
||||
public class ByteToCharMS949 extends ByteToCharDBCS_ASCII {
|
||||
|
||||
private static DoubleByte.Decoder dec =
|
||||
(DoubleByte.Decoder)new MS949().newDecoder();
|
||||
|
||||
public class ByteToCharMS949 extends ByteToCharDoubleByte {
|
||||
private static final MS949 nioCoder = new MS949();
|
||||
|
||||
public String getCharacterEncoding() {
|
||||
return "MS949";
|
||||
}
|
||||
|
||||
public ByteToCharMS949() {
|
||||
super.index1 = nioCoder.getDecoderIndex1();
|
||||
super.index2 = nioCoder.getDecoderIndex2();
|
||||
start = 0x41;
|
||||
end = 0xFE;
|
||||
super(dec);
|
||||
}
|
||||
}
|
||||
|
@ -26,26 +26,18 @@
|
||||
|
||||
package sun.io;
|
||||
|
||||
import sun.nio.cs.ext.MS950;
|
||||
import sun.nio.cs.ext.*;
|
||||
|
||||
/**
|
||||
* Tables and data to convert MS950 to Unicode
|
||||
*
|
||||
* @author ConverterGenerator tool
|
||||
*/
|
||||
public class ByteToCharMS950 extends ByteToCharDBCS_ASCII {
|
||||
|
||||
public class ByteToCharMS950 extends ByteToCharDoubleByte {
|
||||
|
||||
private final static MS950 nioCoder = new MS950();
|
||||
private static DoubleByte.Decoder dec =
|
||||
(DoubleByte.Decoder)new MS950().newDecoder();
|
||||
|
||||
public String getCharacterEncoding() {
|
||||
return "MS950";
|
||||
}
|
||||
|
||||
public ByteToCharMS950() {
|
||||
super.index1 = nioCoder.getDecoderIndex1();
|
||||
super.index2 = nioCoder.getDecoderIndex2();
|
||||
start = 0x40;
|
||||
end = 0xFE;
|
||||
super(dec);
|
||||
}
|
||||
}
|
||||
|
@ -34,6 +34,6 @@ public class ByteToCharMS950_HKSCS extends ByteToCharHKSCS {
|
||||
|
||||
protected char getUnicode(int byte1, int byte2) {
|
||||
char c = super.getUnicode(byte1, byte2);
|
||||
return (c != REPLACE_CHAR) ? c : bcMS950.getUnicode(byte1, byte2);
|
||||
return (c != REPLACE_CHAR) ? c : bcMS950.decodeDouble(byte1, byte2);
|
||||
}
|
||||
}
|
||||
|
@ -25,24 +25,18 @@
|
||||
|
||||
package sun.io;
|
||||
|
||||
import sun.nio.cs.ext.EUC_CN;
|
||||
import sun.nio.cs.ext.*;
|
||||
|
||||
/**
|
||||
* Tables and data to convert Unicode to EUC_CN
|
||||
*
|
||||
* @author ConverterGenerator tool
|
||||
*/
|
||||
public class CharToByteEUC_CN extends CharToByteDBCS_ASCII {
|
||||
|
||||
public class CharToByteEUC_CN extends CharToByteDoubleByte {
|
||||
|
||||
private final static EUC_CN nioCoder = new EUC_CN();
|
||||
private static DoubleByte.Encoder enc =
|
||||
(DoubleByte.Encoder)new EUC_CN().newEncoder();
|
||||
|
||||
public String getCharacterEncoding() {
|
||||
return "EUC_CN";
|
||||
}
|
||||
|
||||
public CharToByteEUC_CN() {
|
||||
super.index1 = nioCoder.getEncoderIndex1();
|
||||
super.index2 = nioCoder.getEncoderIndex2();
|
||||
super(enc);
|
||||
}
|
||||
}
|
||||
|
@ -23,27 +23,20 @@
|
||||
* have any questions.
|
||||
*/
|
||||
|
||||
|
||||
package sun.io;
|
||||
|
||||
import sun.nio.cs.ext.EUC_KR;
|
||||
import sun.nio.cs.ext.*;
|
||||
|
||||
/**
|
||||
* Tables and data to convert Unicode to EUC_KR
|
||||
*
|
||||
* @author ConverterGenerator tool
|
||||
*/
|
||||
public class CharToByteEUC_KR extends CharToByteDBCS_ASCII {
|
||||
|
||||
public class CharToByteEUC_KR extends CharToByteDoubleByte {
|
||||
|
||||
private final static EUC_KR nioCoder = new EUC_KR();
|
||||
private static DoubleByte.Encoder enc =
|
||||
(DoubleByte.Encoder)new EUC_KR().newEncoder();
|
||||
|
||||
public String getCharacterEncoding() {
|
||||
return "EUC_KR";
|
||||
}
|
||||
|
||||
public CharToByteEUC_KR() {
|
||||
super.index1 = nioCoder.getEncoderIndex1();
|
||||
super.index2 = nioCoder.getEncoderIndex2();
|
||||
super(enc);
|
||||
}
|
||||
}
|
||||
|
@ -26,24 +26,18 @@
|
||||
|
||||
package sun.io;
|
||||
|
||||
import sun.nio.cs.ext.GBK;
|
||||
import sun.nio.cs.ext.*;
|
||||
|
||||
/**
|
||||
* Tables and data to convert Unicode to GBK
|
||||
*
|
||||
* @author ConverterGenerator tool
|
||||
*/
|
||||
public class CharToByteGBK extends CharToByteDBCS_ASCII {
|
||||
|
||||
public class CharToByteGBK extends CharToByteDoubleByte {
|
||||
|
||||
private final static GBK nioCoder = new GBK();
|
||||
private static DoubleByte.Encoder enc =
|
||||
(DoubleByte.Encoder)new GBK().newEncoder();
|
||||
|
||||
public String getCharacterEncoding() {
|
||||
return "GBK";
|
||||
}
|
||||
|
||||
public CharToByteGBK() {
|
||||
super.index1 = nioCoder.getEncoderIndex1();
|
||||
super.index2 = nioCoder.getEncoderIndex2();
|
||||
super(enc);
|
||||
}
|
||||
}
|
||||
|
@ -26,24 +26,18 @@
|
||||
|
||||
package sun.io;
|
||||
|
||||
import sun.nio.cs.ext.Johab;
|
||||
import sun.nio.cs.ext.*;
|
||||
|
||||
/**
|
||||
* Tables and data to convert Unicode to Johab
|
||||
*
|
||||
* @author ConverterGenerator tool
|
||||
*/
|
||||
public class CharToByteJohab extends CharToByteDBCS_ASCII {
|
||||
|
||||
public class CharToByteJohab extends CharToByteDoubleByte {
|
||||
|
||||
private final static Johab nioCoder = new Johab();
|
||||
private static DoubleByte.Encoder enc =
|
||||
(DoubleByte.Encoder)new Johab().newEncoder();
|
||||
|
||||
public String getCharacterEncoding() {
|
||||
return "Johab";
|
||||
}
|
||||
|
||||
public CharToByteJohab() {
|
||||
super.index1 = nioCoder.getEncoderIndex1();
|
||||
super.index2 = nioCoder.getEncoderIndex2();
|
||||
super(enc);
|
||||
}
|
||||
}
|
||||
|
@ -25,32 +25,18 @@
|
||||
|
||||
package sun.io;
|
||||
|
||||
/**
|
||||
* Tables and data to convert Unicode to MS932
|
||||
*
|
||||
* @author ConverterGenerator tool
|
||||
*/
|
||||
import sun.nio.cs.ext.*;
|
||||
|
||||
public class CharToByteMS932 extends CharToByteMS932DB {
|
||||
CharToByteJIS0201 cbJIS0201 = new CharToByteJIS0201();
|
||||
public class CharToByteMS932 extends CharToByteDBCS_ASCII {
|
||||
|
||||
private static DoubleByte.Encoder enc =
|
||||
(DoubleByte.Encoder)new MS932().newEncoder();
|
||||
|
||||
public String getCharacterEncoding() {
|
||||
return "MS932";
|
||||
}
|
||||
|
||||
protected int convSingleByte(char inputChar, byte[] outputByte) {
|
||||
byte b;
|
||||
|
||||
// \u0000 - \u007F map straight through
|
||||
if ((inputChar &0xFF80) == 0) {
|
||||
outputByte[0] = (byte)inputChar;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ((b = cbJIS0201.getNative(inputChar)) == 0)
|
||||
return 0;
|
||||
|
||||
outputByte[0] = b;
|
||||
return 1;
|
||||
public CharToByteMS932() {
|
||||
super(enc);
|
||||
}
|
||||
}
|
||||
|
@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Copyright 1998-2003 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Sun designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Sun in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
*/
|
||||
|
||||
package sun.io;
|
||||
|
||||
import sun.nio.cs.ext.MS932DB;
|
||||
|
||||
/**
|
||||
* Tables and data to convert Unicode to MS932
|
||||
*
|
||||
* @author ConverterGenerator tool
|
||||
*/
|
||||
|
||||
abstract class CharToByteMS932DB extends CharToByteDoubleByte {
|
||||
|
||||
public CharToByteMS932DB() {
|
||||
super.index1 = MS932DB.Encoder.index1;
|
||||
super.index2 = MS932DB.Encoder.index2;
|
||||
}
|
||||
}
|
@ -25,24 +25,18 @@
|
||||
|
||||
package sun.io;
|
||||
|
||||
import sun.nio.cs.ext.MS936;
|
||||
import sun.nio.cs.ext.*;
|
||||
|
||||
/**
|
||||
* Tables and data to convert Unicode to MS936
|
||||
*
|
||||
* @author ConverterGenerator tool
|
||||
*/
|
||||
public class CharToByteMS936 extends CharToByteDBCS_ASCII {
|
||||
|
||||
public class CharToByteMS936 extends CharToByteDoubleByte {
|
||||
|
||||
private final static MS936 nioCoder = new MS936();
|
||||
private static DoubleByte.Encoder enc =
|
||||
(DoubleByte.Encoder)new MS936().newEncoder();
|
||||
|
||||
public String getCharacterEncoding() {
|
||||
return "MS936";
|
||||
}
|
||||
|
||||
public CharToByteMS936() {
|
||||
super.index1 = nioCoder.getEncoderIndex1();
|
||||
super.index2 = nioCoder.getEncoderIndex2();
|
||||
super(enc);
|
||||
}
|
||||
}
|
||||
|
@ -26,24 +26,18 @@
|
||||
|
||||
package sun.io;
|
||||
|
||||
import sun.nio.cs.ext.MS949;
|
||||
import sun.nio.cs.ext.*;
|
||||
|
||||
/**
|
||||
* Tables and data to convert Unicode to MS949
|
||||
*
|
||||
* @author ConverterGenerator tool
|
||||
*/
|
||||
public class CharToByteMS949 extends CharToByteDBCS_ASCII {
|
||||
|
||||
public class CharToByteMS949 extends CharToByteDoubleByte {
|
||||
|
||||
private final static MS949 nioCoder = new MS949();
|
||||
private static DoubleByte.Encoder enc =
|
||||
(DoubleByte.Encoder)new MS949().newEncoder();
|
||||
|
||||
public String getCharacterEncoding() {
|
||||
return "MS949";
|
||||
}
|
||||
|
||||
public CharToByteMS949() {
|
||||
super.index1 = nioCoder.getEncoderIndex1();
|
||||
super.index2 = nioCoder.getEncoderIndex2();
|
||||
super(enc);
|
||||
}
|
||||
}
|
||||
|
@ -26,24 +26,18 @@
|
||||
|
||||
package sun.io;
|
||||
|
||||
import sun.nio.cs.ext.MS950;
|
||||
import sun.nio.cs.ext.*;
|
||||
|
||||
/**
|
||||
* Tables and data to convert Unicode to MS950
|
||||
*
|
||||
* @author ConverterGenerator tool
|
||||
*/
|
||||
public class CharToByteMS950 extends CharToByteDBCS_ASCII {
|
||||
|
||||
public class CharToByteMS950 extends CharToByteDoubleByte {
|
||||
|
||||
private final static MS950 nioCoder = new MS950();
|
||||
private static DoubleByte.Encoder enc =
|
||||
(DoubleByte.Encoder)new MS950().newEncoder();
|
||||
|
||||
public String getCharacterEncoding() {
|
||||
return "MS950";
|
||||
}
|
||||
|
||||
public CharToByteMS950() {
|
||||
super.index1 = nioCoder.getEncoderIndex1();
|
||||
super.index2 = nioCoder.getEncoderIndex2();
|
||||
super(enc);
|
||||
}
|
||||
}
|
||||
|
@ -34,6 +34,6 @@ public class CharToByteMS950_HKSCS extends CharToByteHKSCS {
|
||||
|
||||
protected int getNative(char ch) {
|
||||
int r = super.getNative(ch);
|
||||
return (r != 0) ? r : cbMS950.getNative(ch);
|
||||
return (r != 0) ? r : cbMS950.encodeChar(ch);
|
||||
}
|
||||
}
|
||||
|
@ -106,7 +106,10 @@ public class DoubleByte {
|
||||
Arrays.fill(B2C_UNMAPPABLE, (char)UNMAPPABLE_DECODING);
|
||||
}
|
||||
|
||||
public static class Decoder extends CharsetDecoder {
|
||||
public static class Decoder extends CharsetDecoder
|
||||
implements DelegatableDecoder
|
||||
{
|
||||
|
||||
final char[][] b2c;
|
||||
final char[] b2cSB;
|
||||
final int b2Min;
|
||||
@ -174,6 +177,7 @@ public class DoubleByte {
|
||||
protected CoderResult decodeBufferLoop(ByteBuffer src, CharBuffer dst) {
|
||||
int mark = src.position();
|
||||
try {
|
||||
|
||||
while (src.hasRemaining() && dst.hasRemaining()) {
|
||||
int b1 = src.get() & 0xff;
|
||||
char c = b2cSB[b1];
|
||||
@ -197,13 +201,22 @@ public class DoubleByte {
|
||||
}
|
||||
}
|
||||
|
||||
protected CoderResult decodeLoop(ByteBuffer src, CharBuffer dst) {
|
||||
// Make some protected methods public for use by JISAutoDetect
|
||||
public CoderResult decodeLoop(ByteBuffer src, CharBuffer dst) {
|
||||
if (src.hasArray() && dst.hasArray())
|
||||
return decodeArrayLoop(src, dst);
|
||||
else
|
||||
return decodeBufferLoop(src, dst);
|
||||
}
|
||||
|
||||
public void implReset() {
|
||||
super.implReset();
|
||||
}
|
||||
|
||||
public CoderResult implFlush(CharBuffer out) {
|
||||
return super.implFlush(out);
|
||||
}
|
||||
|
||||
// decode loops are not using decodeSingle/Double() for performance
|
||||
// reason.
|
||||
public char decodeSingle(int b) {
|
||||
@ -230,7 +243,7 @@ public class DoubleByte {
|
||||
super(cs, b2c, b2cSB, b2Min, b2Max);
|
||||
}
|
||||
|
||||
protected void implReset() {
|
||||
public void implReset() {
|
||||
currentState = SBCS;
|
||||
}
|
||||
|
||||
@ -400,7 +413,7 @@ public class DoubleByte {
|
||||
private final char[] c2bIndex;
|
||||
Surrogate.Parser sgp;
|
||||
|
||||
Encoder(Charset cs, char[] c2b, char[] c2bIndex) {
|
||||
protected Encoder(Charset cs, char[] c2b, char[] c2bIndex) {
|
||||
super(cs, 2.0f, 2.0f);
|
||||
this.c2b = c2b;
|
||||
this.c2bIndex = c2bIndex;
|
||||
|
@ -86,14 +86,14 @@ public class ISO2022_CN
|
||||
|
||||
private static final Charset gb2312 = new EUC_CN();
|
||||
private static final Charset cns = new EUC_TW();
|
||||
private final EUC_CN.Decoder gb2312Decoder;
|
||||
private final DoubleByte.Decoder gb2312Decoder;
|
||||
private final EUC_TW.Decoder cnsDecoder;
|
||||
|
||||
Decoder(Charset cs) {
|
||||
super(cs, 1.0f, 1.0f);
|
||||
shiftOut = false;
|
||||
currentSODesig = SODesigGB;
|
||||
gb2312Decoder = (EUC_CN.Decoder)gb2312.newDecoder();
|
||||
gb2312Decoder = (DoubleByte.Decoder)gb2312.newDecoder();
|
||||
cnsDecoder = (EUC_TW.Decoder)cns.newDecoder();
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,7 @@ package sun.nio.cs.ext;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class MS932_0213 extends Charset {
|
||||
public MS932_0213() {
|
||||
@ -49,30 +50,31 @@ public class MS932_0213 extends Charset {
|
||||
}
|
||||
|
||||
protected static class Decoder extends SJIS_0213.Decoder {
|
||||
MS932DB.Decoder decMS932;
|
||||
static DoubleByte.Decoder decMS932 =
|
||||
(DoubleByte.Decoder)new MS932().newDecoder();
|
||||
protected Decoder(Charset cs) {
|
||||
super(cs);
|
||||
decMS932 = new MS932DB.Decoder(cs);
|
||||
}
|
||||
|
||||
protected char decodeDouble(int b1, int b2) {
|
||||
char c = decMS932.decodeDouble(b1, b2);
|
||||
if (c == DoubleByteDecoder.REPLACE_CHAR)
|
||||
if (c == UNMAPPABLE_DECODING)
|
||||
return super.decodeDouble(b1, b2);
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
||||
protected static class Encoder extends SJIS_0213.Encoder {
|
||||
MS932DB.Encoder encMS932;
|
||||
// we only use its encodeChar() method
|
||||
static DoubleByte.Encoder encMS932 =
|
||||
(DoubleByte.Encoder)new MS932().newEncoder();
|
||||
protected Encoder(Charset cs) {
|
||||
super(cs);
|
||||
encMS932 = new MS932DB.Encoder(cs);
|
||||
}
|
||||
|
||||
protected int encodeChar(char ch) {
|
||||
int db = encMS932.encodeDouble(ch);
|
||||
if (db == 0)
|
||||
int db = encMS932.encodeChar(ch);
|
||||
if (db == UNMAPPABLE_ENCODING)
|
||||
return super.encodeChar(ch);
|
||||
return db;
|
||||
}
|
||||
|
@ -23,15 +23,13 @@
|
||||
* have any questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class MS950_HKSCS extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
@ -59,8 +57,8 @@ public class MS950_HKSCS extends Charset implements HistoricallyNamedCharset
|
||||
|
||||
private static class Decoder extends HKSCS.Decoder {
|
||||
|
||||
private MS950.Decoder ms950Dec;
|
||||
|
||||
private static DoubleByte.Decoder ms950Dec =
|
||||
(DoubleByte.Decoder)new MS950().newDecoder();
|
||||
|
||||
/*
|
||||
* Note current decoder decodes 0x8BC2 --> U+F53A
|
||||
@ -73,18 +71,18 @@ public class MS950_HKSCS extends Charset implements HistoricallyNamedCharset
|
||||
|
||||
protected char decodeDouble(int byte1, int byte2) {
|
||||
char c = super.decodeDouble(byte1, byte2);
|
||||
return (c != REPLACE_CHAR) ? c : ms950Dec.decodeDouble(byte1, byte2);
|
||||
return (c != UNMAPPABLE_DECODING) ? c : ms950Dec.decodeDouble(byte1, byte2);
|
||||
}
|
||||
|
||||
private Decoder(Charset cs) {
|
||||
super(cs);
|
||||
ms950Dec = new MS950.Decoder(cs);
|
||||
}
|
||||
}
|
||||
|
||||
private static class Encoder extends HKSCS.Encoder {
|
||||
|
||||
private MS950.Encoder ms950Enc;
|
||||
private static DoubleByte.Encoder ms950Enc =
|
||||
(DoubleByte.Encoder)new MS950().newEncoder();
|
||||
|
||||
/*
|
||||
* Note current encoder encodes U+F53A --> 0x8BC2
|
||||
@ -93,12 +91,11 @@ public class MS950_HKSCS extends Charset implements HistoricallyNamedCharset
|
||||
*/
|
||||
protected int encodeDouble(char ch) {
|
||||
int r = super.encodeDouble(ch);
|
||||
return (r != 0) ? r : ms950Enc.encodeDouble(ch);
|
||||
return (r != UNMAPPABLE_ENCODING) ? r : ms950Enc.encodeChar(ch);
|
||||
}
|
||||
|
||||
private Encoder(Charset cs) {
|
||||
super(cs);
|
||||
ms950Enc = new MS950.Encoder(cs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,8 @@ package sun.awt.motif;
|
||||
import java.nio.CharBuffer;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.*;
|
||||
import sun.nio.cs.ext.EUC_CN;
|
||||
import sun.nio.cs.ext.*;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class X11GB2312 extends Charset {
|
||||
public X11GB2312 () {
|
||||
@ -45,16 +46,22 @@ public class X11GB2312 extends Charset {
|
||||
return cs instanceof X11GB2312;
|
||||
}
|
||||
|
||||
private class Encoder extends EUC_CN.Encoder {
|
||||
private class Encoder extends CharsetEncoder {
|
||||
private DoubleByte.Encoder enc = (DoubleByte.Encoder)new EUC_CN().newEncoder();
|
||||
|
||||
public Encoder(Charset cs) {
|
||||
super(cs);
|
||||
super(cs, 2.0f, 2.0f);
|
||||
}
|
||||
|
||||
public boolean canEncode(char c) {
|
||||
if (c <= 0x7F) {
|
||||
return false;
|
||||
}
|
||||
return super.canEncode(c);
|
||||
return enc.canEncode(c);
|
||||
}
|
||||
|
||||
protected int encodeDouble(char c) {
|
||||
return enc.encodeChar(c);
|
||||
}
|
||||
|
||||
protected CoderResult encodeLoop(CharBuffer src, ByteBuffer dst) {
|
||||
@ -91,9 +98,15 @@ public class X11GB2312 extends Charset {
|
||||
}
|
||||
}
|
||||
|
||||
private class Decoder extends EUC_CN.Decoder {
|
||||
private class Decoder extends CharsetDecoder {
|
||||
private DoubleByte.Decoder dec = (DoubleByte.Decoder)new EUC_CN().newDecoder();
|
||||
|
||||
public Decoder(Charset cs) {
|
||||
super(cs);
|
||||
super(cs, 0.5f, 1.0f);
|
||||
}
|
||||
|
||||
protected char decodeDouble(int b1, int b2) {
|
||||
return dec.decodeDouble(b1, b2);
|
||||
}
|
||||
|
||||
protected CoderResult decodeLoop(ByteBuffer src, CharBuffer dst) {
|
||||
@ -116,7 +129,7 @@ public class X11GB2312 extends Charset {
|
||||
int b1 = sa[sp] & 0xFF | 0x80;
|
||||
int b2 = sa[sp + 1] & 0xFF | 0x80;
|
||||
char c = decodeDouble(b1, b2);
|
||||
if (c == replacement().charAt(0)) {
|
||||
if (c == UNMAPPABLE_DECODING) {
|
||||
return CoderResult.unmappableForLength(2);
|
||||
}
|
||||
if (dl - dp < 1)
|
||||
|
@ -25,10 +25,9 @@
|
||||
|
||||
package sun.awt.motif;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import sun.nio.cs.ext.GBK;
|
||||
import java.nio.charset.*;
|
||||
import sun.nio.cs.ext.*;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class X11GBK extends Charset {
|
||||
public X11GBK () {
|
||||
@ -38,20 +37,30 @@ public class X11GBK extends Charset {
|
||||
return new Encoder(this);
|
||||
}
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new GBK.Decoder(this);
|
||||
return new GBK().newDecoder();
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return cs instanceof X11GBK;
|
||||
}
|
||||
|
||||
private class Encoder extends GBK.Encoder {
|
||||
public Encoder(Charset cs) {
|
||||
super(cs);
|
||||
private class Encoder extends DoubleByte.Encoder {
|
||||
|
||||
private DoubleByte.Encoder enc = (DoubleByte.Encoder)new GBK().newEncoder();
|
||||
|
||||
Encoder(Charset cs) {
|
||||
super(cs, (char[])null, (char[])null);
|
||||
}
|
||||
|
||||
public boolean canEncode(char ch){
|
||||
if (ch < 0x80) return false;
|
||||
return super.canEncode(ch);
|
||||
return enc.canEncode(ch);
|
||||
}
|
||||
|
||||
public int encodeChar(char ch) {
|
||||
if (ch < 0x80)
|
||||
return UNMAPPABLE_ENCODING;
|
||||
return enc.encodeChar(ch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,8 @@ package sun.awt.motif;
|
||||
import java.nio.CharBuffer;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.*;
|
||||
import sun.nio.cs.ext.EUC_KR;
|
||||
import sun.nio.cs.ext.*;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class X11KSC5601 extends Charset {
|
||||
public X11KSC5601 () {
|
||||
@ -45,16 +46,22 @@ public class X11KSC5601 extends Charset {
|
||||
return cs instanceof X11KSC5601;
|
||||
}
|
||||
|
||||
private class Encoder extends EUC_KR.Encoder {
|
||||
private class Encoder extends CharsetEncoder {
|
||||
private DoubleByte.Encoder enc = (DoubleByte.Encoder)new EUC_KR().newEncoder();
|
||||
|
||||
public Encoder(Charset cs) {
|
||||
super(cs);
|
||||
super(cs, 2.0f, 2.0f);
|
||||
}
|
||||
|
||||
public boolean canEncode(char c) {
|
||||
if (c <= 0x7F) {
|
||||
return false;
|
||||
}
|
||||
return super.canEncode(c);
|
||||
return enc.canEncode(c);
|
||||
}
|
||||
|
||||
protected int encodeDouble(char c) {
|
||||
return enc.encodeChar(c);
|
||||
}
|
||||
|
||||
protected CoderResult encodeLoop(CharBuffer src, ByteBuffer dst) {
|
||||
@ -90,9 +97,15 @@ public class X11KSC5601 extends Charset {
|
||||
}
|
||||
}
|
||||
|
||||
private class Decoder extends EUC_KR.Decoder {
|
||||
private class Decoder extends CharsetDecoder {
|
||||
private DoubleByte.Decoder dec = (DoubleByte.Decoder)new EUC_KR().newDecoder();
|
||||
|
||||
public Decoder(Charset cs) {
|
||||
super(cs);
|
||||
super(cs, 0.5f, 1.0f);
|
||||
}
|
||||
|
||||
protected char decodeDouble(int b1, int b2) {
|
||||
return dec.decodeDouble(b1, b2);
|
||||
}
|
||||
|
||||
protected CoderResult decodeLoop(ByteBuffer src, CharBuffer dst) {
|
||||
@ -116,7 +129,7 @@ public class X11KSC5601 extends Charset {
|
||||
int b1 = sa[sp] & 0xFF | 0x80;
|
||||
int b2 = sa[sp + 1] & 0xFF | 0x80;
|
||||
char c = decodeDouble(b1, b2);
|
||||
if (c == replacement().charAt(0)) {
|
||||
if (c == UNMAPPABLE_DECODING) {
|
||||
return CoderResult.unmappableForLength(2);
|
||||
}
|
||||
if (dl - dp < 1)
|
||||
|
182
jdk/test/sun/nio/cs/OLD/DoubleByteDecoder.java
Normal file
182
jdk/test/sun/nio/cs/OLD/DoubleByteDecoder.java
Normal file
@ -0,0 +1,182 @@
|
||||
/*
|
||||
* Copyright 2002-2005 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Sun designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Sun in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
*/
|
||||
|
||||
//package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.CharBuffer;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CoderResult;
|
||||
|
||||
abstract class DoubleByteDecoder
|
||||
extends CharsetDecoder
|
||||
{
|
||||
|
||||
private short index1[];
|
||||
|
||||
/*
|
||||
* 2nd level index, provided by subclass
|
||||
* every string has 0x10*(end-start+1) characters.
|
||||
*/
|
||||
private String index2[];
|
||||
|
||||
protected int start;
|
||||
protected int end;
|
||||
|
||||
protected static final char REPLACE_CHAR = '\uFFFD';
|
||||
protected char highSurrogate;
|
||||
protected char lowSurrogate;
|
||||
|
||||
protected DoubleByteDecoder(Charset cs, short[] index1, String[] index2,
|
||||
int start, int end ) {
|
||||
super(cs, 0.5f, 1.0f);
|
||||
this.index1 = index1;
|
||||
this.index2 = index2;
|
||||
this.start = start;
|
||||
this.end = end;
|
||||
}
|
||||
|
||||
private CoderResult decodeArrayLoop(ByteBuffer src, CharBuffer dst) {
|
||||
byte[] sa = src.array();
|
||||
int sp = src.arrayOffset() + src.position();
|
||||
int sl = src.arrayOffset() + src.limit();
|
||||
assert (sp <= sl);
|
||||
sp = (sp <= sl ? sp : sl);
|
||||
char[] da = dst.array();
|
||||
int dp = dst.arrayOffset() + dst.position();
|
||||
int dl = dst.arrayOffset() + dst.limit();
|
||||
assert (dp <= dl);
|
||||
dp = (dp <= dl ? dp : dl);
|
||||
|
||||
try {
|
||||
while (sp < sl) {
|
||||
int b1, b2;
|
||||
b1 = sa[sp];
|
||||
int inputSize = 1;
|
||||
int outputSize = 1;
|
||||
highSurrogate = lowSurrogate = 0;
|
||||
char c = decodeSingle(b1);
|
||||
if (c == REPLACE_CHAR) {
|
||||
b1 &= 0xff;
|
||||
if (sl - sp < 2)
|
||||
return CoderResult.UNDERFLOW;
|
||||
b2 = sa[sp + 1] & 0xff;
|
||||
c = decodeDouble(b1, b2);
|
||||
inputSize = 2;
|
||||
if (c == REPLACE_CHAR)
|
||||
return CoderResult.unmappableForLength(inputSize);
|
||||
outputSize = (highSurrogate > 0) ? 2: 1;
|
||||
}
|
||||
|
||||
if (dl - dp < outputSize)
|
||||
return CoderResult.OVERFLOW;
|
||||
if (outputSize == 2) {
|
||||
da[dp++] = highSurrogate;
|
||||
da[dp++] = lowSurrogate;
|
||||
} else {
|
||||
da[dp++] = c;
|
||||
}
|
||||
sp += inputSize;
|
||||
}
|
||||
return CoderResult.UNDERFLOW;
|
||||
} finally {
|
||||
src.position(sp - src.arrayOffset());
|
||||
dst.position(dp - dst.arrayOffset());
|
||||
}
|
||||
}
|
||||
|
||||
private CoderResult decodeBufferLoop(ByteBuffer src, CharBuffer dst) {
|
||||
int mark = src.position();
|
||||
int inputSize = 0;
|
||||
int outputSize = 0;
|
||||
try {
|
||||
while (src.hasRemaining()) {
|
||||
int b1 = src.get();
|
||||
inputSize = 1;
|
||||
outputSize = 1;
|
||||
highSurrogate = lowSurrogate = 0;
|
||||
|
||||
char c = decodeSingle(b1);
|
||||
|
||||
if (c == REPLACE_CHAR) {
|
||||
if (src.remaining() < 1)
|
||||
return CoderResult.UNDERFLOW;
|
||||
b1 &= 0xff;
|
||||
int b2 = src.get() & 0xff;
|
||||
inputSize = 2;
|
||||
|
||||
c = decodeDouble(b1, b2);
|
||||
|
||||
if (c == REPLACE_CHAR)
|
||||
return CoderResult.unmappableForLength(2);
|
||||
|
||||
outputSize = (highSurrogate > 0) ? 2: 1;
|
||||
}
|
||||
if (dst.remaining() < outputSize)
|
||||
return CoderResult.OVERFLOW;
|
||||
mark += inputSize;
|
||||
|
||||
if (outputSize == 2) {
|
||||
dst.put(highSurrogate);
|
||||
dst.put(lowSurrogate);
|
||||
} else {
|
||||
dst.put(c);
|
||||
}
|
||||
}
|
||||
return CoderResult.UNDERFLOW;
|
||||
} finally {
|
||||
src.position(mark);
|
||||
}
|
||||
}
|
||||
|
||||
protected CoderResult decodeLoop(ByteBuffer src, CharBuffer dst) {
|
||||
if (src.hasArray() && dst.hasArray())
|
||||
return decodeArrayLoop(src, dst);
|
||||
else
|
||||
return decodeBufferLoop(src, dst);
|
||||
}
|
||||
|
||||
/*
|
||||
* Can be changed by subclass
|
||||
*/
|
||||
protected char decodeSingle(int b) {
|
||||
if (b >= 0)
|
||||
return (char) b;
|
||||
return REPLACE_CHAR;
|
||||
}
|
||||
|
||||
protected char decodeDouble(int byte1, int byte2) {
|
||||
if (((byte1 < 0) || (byte1 > index1.length))
|
||||
|| ((byte2 < start) || (byte2 > end)))
|
||||
return REPLACE_CHAR;
|
||||
|
||||
int n = (index1[byte1] & 0xf) * (end - start + 1) + (byte2 - start);
|
||||
return index2[index1[byte1] >> 4].charAt(n);
|
||||
}
|
||||
}
|
241
jdk/test/sun/nio/cs/OLD/DoubleByteEncoder.java
Normal file
241
jdk/test/sun/nio/cs/OLD/DoubleByteEncoder.java
Normal file
@ -0,0 +1,241 @@
|
||||
/*
|
||||
* Copyright 2002-2006 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Sun designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Sun in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
*/
|
||||
|
||||
//package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.CharBuffer;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.nio.charset.CoderResult;
|
||||
import sun.nio.cs.Surrogate;
|
||||
|
||||
public abstract class DoubleByteEncoder
|
||||
extends CharsetEncoder
|
||||
{
|
||||
|
||||
private short index1[];
|
||||
private String index2[];
|
||||
|
||||
private final Surrogate.Parser sgp = new Surrogate.Parser();
|
||||
|
||||
protected DoubleByteEncoder(Charset cs,
|
||||
short[] index1, String[] index2)
|
||||
{
|
||||
super(cs, 2.0f, 2.0f);
|
||||
this.index1 = index1;
|
||||
this.index2 = index2;
|
||||
}
|
||||
|
||||
protected DoubleByteEncoder(Charset cs,
|
||||
short[] index1, String[] index2,
|
||||
float avg, float max)
|
||||
{
|
||||
super(cs, avg, max);
|
||||
this.index1 = index1;
|
||||
this.index2 = index2;
|
||||
}
|
||||
|
||||
protected DoubleByteEncoder(Charset cs,
|
||||
short[] index1, String[] index2, byte[] repl)
|
||||
{
|
||||
super(cs, 2.0f, 2.0f, repl);
|
||||
this.index1 = index1;
|
||||
this.index2 = index2;
|
||||
}
|
||||
|
||||
|
||||
protected DoubleByteEncoder(Charset cs,
|
||||
short[] index1, String[] index2,
|
||||
byte[] repl, float avg, float max)
|
||||
{
|
||||
super(cs, avg, max,repl);
|
||||
this.index1 = index1;
|
||||
this.index2 = index2;
|
||||
}
|
||||
|
||||
public boolean canEncode(char c) {
|
||||
return (encodeSingle(c) != -1 ||
|
||||
encodeDouble(c) != 0);
|
||||
}
|
||||
|
||||
private CoderResult encodeArrayLoop(CharBuffer src, ByteBuffer dst) {
|
||||
char[] sa = src.array();
|
||||
int sp = src.arrayOffset() + src.position();
|
||||
int sl = src.arrayOffset() + src.limit();
|
||||
byte[] da = dst.array();
|
||||
int dp = dst.arrayOffset() + dst.position();
|
||||
int dl = dst.arrayOffset() + dst.limit();
|
||||
|
||||
try {
|
||||
while (sp < sl) {
|
||||
char c = sa[sp];
|
||||
if (Surrogate.is(c)) {
|
||||
if (sgp.parse(c, sa, sp, sl) < 0)
|
||||
return sgp.error();
|
||||
if (sl - sp < 2)
|
||||
return CoderResult.UNDERFLOW;
|
||||
char c2 = sa[sp + 1];
|
||||
|
||||
byte[] outputBytes = new byte[2];
|
||||
outputBytes = encodeSurrogate(c, c2);
|
||||
|
||||
if (outputBytes == null) {
|
||||
return sgp.unmappableResult();
|
||||
}
|
||||
else {
|
||||
if (dl - dp < 2)
|
||||
return CoderResult.OVERFLOW;
|
||||
da[dp++] = outputBytes[0];
|
||||
da[dp++] = outputBytes[1];
|
||||
sp += 2;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (c >= '\uFFFE')
|
||||
return CoderResult.unmappableForLength(1);
|
||||
|
||||
int b = encodeSingle(c);
|
||||
if (b != -1) { // Single Byte
|
||||
if (dl - dp < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
da[dp++] = (byte)b;
|
||||
sp++;
|
||||
continue;
|
||||
}
|
||||
|
||||
int ncode = encodeDouble(c);
|
||||
if (ncode != 0 && c != '\u0000' ) {
|
||||
if (dl - dp < 2)
|
||||
return CoderResult.OVERFLOW;
|
||||
da[dp++] = (byte) ((ncode & 0xff00) >> 8);
|
||||
da[dp++] = (byte) (ncode & 0xff);
|
||||
sp++;
|
||||
continue;
|
||||
}
|
||||
return CoderResult.unmappableForLength(1);
|
||||
}
|
||||
return CoderResult.UNDERFLOW;
|
||||
} finally {
|
||||
src.position(sp - src.arrayOffset());
|
||||
dst.position(dp - dst.arrayOffset());
|
||||
}
|
||||
}
|
||||
|
||||
private CoderResult encodeBufferLoop(CharBuffer src, ByteBuffer dst) {
|
||||
int mark = src.position();
|
||||
|
||||
try {
|
||||
while (src.hasRemaining()) {
|
||||
char c = src.get();
|
||||
if (Surrogate.is(c)) {
|
||||
int surr;
|
||||
if ((surr = sgp.parse(c, src)) < 0)
|
||||
return sgp.error();
|
||||
char c2 = Surrogate.low(surr);
|
||||
byte[] outputBytes = new byte[2];
|
||||
outputBytes = encodeSurrogate(c, c2);
|
||||
|
||||
if (outputBytes == null) {
|
||||
return sgp.unmappableResult();
|
||||
} else {
|
||||
if (dst.remaining() < 2)
|
||||
return CoderResult.OVERFLOW;
|
||||
mark += 2;
|
||||
dst.put(outputBytes[0]);
|
||||
dst.put(outputBytes[1]);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (c >= '\uFFFE')
|
||||
return CoderResult.unmappableForLength(1);
|
||||
int b = encodeSingle(c);
|
||||
|
||||
if (b != -1) { // Single-byte character
|
||||
if (dst.remaining() < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
mark++;
|
||||
dst.put((byte)b);
|
||||
continue;
|
||||
}
|
||||
// Double Byte character
|
||||
|
||||
int ncode = encodeDouble(c);
|
||||
if (ncode != 0 && c != '\u0000') {
|
||||
if (dst.remaining() < 2)
|
||||
return CoderResult.OVERFLOW;
|
||||
mark++;
|
||||
dst.put((byte) ((ncode & 0xff00) >> 8));
|
||||
dst.put((byte) ncode);
|
||||
continue;
|
||||
}
|
||||
return CoderResult.unmappableForLength(1);
|
||||
}
|
||||
|
||||
return CoderResult.UNDERFLOW;
|
||||
} finally {
|
||||
src.position(mark);
|
||||
}
|
||||
}
|
||||
|
||||
protected CoderResult encodeLoop(CharBuffer src, ByteBuffer dst) {
|
||||
if (true && src.hasArray() && dst.hasArray())
|
||||
return encodeArrayLoop(src, dst);
|
||||
else
|
||||
return encodeBufferLoop(src, dst);
|
||||
}
|
||||
|
||||
/*
|
||||
* Can be changed by subclass
|
||||
*/
|
||||
protected int encodeDouble(char ch) {
|
||||
int offset = index1[((ch & 0xff00) >> 8 )] << 8;
|
||||
return index2[offset >> 12].charAt((offset & 0xfff) + (ch & 0xff));
|
||||
}
|
||||
|
||||
/*
|
||||
* Can be changed by subclass
|
||||
*/
|
||||
protected int encodeSingle(char inputChar) {
|
||||
if (inputChar < 0x80)
|
||||
return (byte)inputChar;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Protected method which should be overridden by concrete DBCS
|
||||
* CharsetEncoder classes which included supplementary characters
|
||||
* within their mapping coverage.
|
||||
* null return value indicates surrogate values could not be
|
||||
* handled or encoded.
|
||||
*/
|
||||
protected byte[] encodeSurrogate(char highSurrogate, char lowSurrogate) {
|
||||
return null;
|
||||
}
|
||||
}
|
@ -23,23 +23,18 @@
|
||||
* have any questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
|
||||
public class EUC_CN
|
||||
public class EUC_CN_OLD
|
||||
extends Charset
|
||||
implements HistoricallyNamedCharset
|
||||
{
|
||||
|
||||
public EUC_CN() {
|
||||
super("GB2312", ExtendedCharsets.aliasesFor("GB2312"));
|
||||
public EUC_CN_OLD() {
|
||||
super("GB2312-OLD", null);
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
@ -47,7 +42,7 @@ public class EUC_CN
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return ((cs instanceof EUC_CN)
|
||||
return ((cs instanceof EUC_CN_OLD)
|
||||
|| (cs.name().equals("US-ASCII")));
|
||||
}
|
||||
|
||||
@ -60,16 +55,16 @@ public class EUC_CN
|
||||
}
|
||||
|
||||
public short[] getDecoderIndex1() {
|
||||
return EUC_CN.Decoder.index1;
|
||||
return Decoder.index1;
|
||||
}
|
||||
public String[] getDecoderIndex2() {
|
||||
return EUC_CN.Decoder.index2;
|
||||
return Decoder.index2;
|
||||
}
|
||||
public short[] getEncoderIndex1() {
|
||||
return EUC_CN.Encoder.index1;
|
||||
return Encoder.index1;
|
||||
}
|
||||
public String[] getEncoderIndex2() {
|
||||
return EUC_CN.Encoder.index2;
|
||||
return Encoder.index2;
|
||||
}
|
||||
|
||||
public static class Decoder extends DoubleByteDecoder {
|
@ -27,7 +27,7 @@
|
||||
/*
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
//package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
@ -35,12 +35,12 @@ import java.nio.charset.CharsetEncoder;
|
||||
import java.nio.charset.CharacterCodingException;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
|
||||
public class EUC_KR
|
||||
public class EUC_KR_OLD
|
||||
extends Charset
|
||||
implements HistoricallyNamedCharset
|
||||
{
|
||||
public EUC_KR() {
|
||||
super("EUC-KR", ExtendedCharsets.aliasesFor("EUC-KR"));
|
||||
public EUC_KR_OLD() {
|
||||
super("EUC-KR-OLD", null);
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
@ -48,7 +48,7 @@ public class EUC_KR
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return ((cs instanceof EUC_KR)
|
||||
return ((cs instanceof EUC_KR_OLD)
|
||||
|| (cs.name().equals("US-ASCII")));
|
||||
}
|
||||
|
@ -27,24 +27,22 @@
|
||||
/*
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.nio.charset.CharacterCodingException;
|
||||
|
||||
public class GBK
|
||||
public class GBK_OLD
|
||||
extends Charset
|
||||
{
|
||||
|
||||
public GBK() {
|
||||
super("GBK", ExtendedCharsets.aliasesFor("GBK"));
|
||||
public GBK_OLD() {
|
||||
super("GBK-OLD", null);
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return ((cs.name().equals("US-ASCII"))
|
||||
|| (cs instanceof GBK));
|
||||
|| (cs instanceof GBK_OLD));
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2002-2003 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
@ -27,24 +26,23 @@
|
||||
/*
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
//package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.nio.charset.CharacterCodingException;
|
||||
|
||||
public class Johab
|
||||
extends Charset
|
||||
public class Johab_OLD extends Charset
|
||||
{
|
||||
|
||||
public Johab() {
|
||||
super("x-Johab", ExtendedCharsets.aliasesFor("x-Johab"));
|
||||
public Johab_OLD() {
|
||||
super("x-Johab-OLD", null);
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return ((cs.name().equals("US-ASCII"))
|
||||
|| (cs instanceof Johab));
|
||||
|| (cs instanceof Johab_OLD));
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
@ -26,7 +26,6 @@
|
||||
/*
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
@ -24,8 +24,6 @@
|
||||
*/
|
||||
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.CharBuffer;
|
||||
import java.nio.charset.Charset;
|
||||
@ -33,11 +31,12 @@ import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.nio.charset.CoderResult;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import sun.nio.cs.ext.*;
|
||||
|
||||
public class MS932 extends Charset implements HistoricallyNamedCharset
|
||||
public class MS932_OLD extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
public MS932() {
|
||||
super("windows-31j", ExtendedCharsets.aliasesFor("windows-31j"));
|
||||
public MS932_OLD() {
|
||||
super("windows-31j-OLD", null);
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
@ -47,7 +46,7 @@ public class MS932 extends Charset implements HistoricallyNamedCharset
|
||||
public boolean contains(Charset cs) {
|
||||
return ((cs.name().equals("US-ASCII"))
|
||||
|| (cs instanceof JIS_X_0201)
|
||||
|| (cs instanceof MS932));
|
||||
|| (cs instanceof MS932_OLD));
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
@ -59,7 +58,8 @@ public class MS932 extends Charset implements HistoricallyNamedCharset
|
||||
}
|
||||
|
||||
private static class Decoder extends MS932DB.Decoder
|
||||
implements DelegatableDecoder {
|
||||
// implements DelegatableDecoder
|
||||
{
|
||||
|
||||
JIS_X_0201.Decoder jisDec0201;
|
||||
|
@ -27,20 +27,19 @@
|
||||
/*
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
//package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
|
||||
public class MS936
|
||||
extends Charset
|
||||
public class MS936_OLD extends Charset
|
||||
implements HistoricallyNamedCharset
|
||||
{
|
||||
|
||||
public MS936() {
|
||||
super("x-mswin-936", ExtendedCharsets.aliasesFor("x-mswin-936"));
|
||||
public MS936_OLD() {
|
||||
super("x-mswin-936-OLD", null);
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
@ -49,7 +48,7 @@ public class MS936
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return ((cs.name().equals("US-ASCII"))
|
||||
|| (cs instanceof MS936));
|
||||
|| (cs instanceof MS936_OLD));
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
@ -70,16 +69,16 @@ public class MS936
|
||||
*/
|
||||
|
||||
public short[] getDecoderIndex1() {
|
||||
return MS936.Decoder.index1;
|
||||
return Decoder.index1;
|
||||
}
|
||||
public String[] getDecoderIndex2() {
|
||||
return MS936.Decoder.index2;
|
||||
return Decoder.index2;
|
||||
}
|
||||
public short[] getEncoderIndex1() {
|
||||
return MS936.Encoder.index1;
|
||||
return Encoder.index1;
|
||||
}
|
||||
public String[] getEncoderIndex2() {
|
||||
return MS936.Encoder.index2;
|
||||
return Encoder.index2;
|
||||
}
|
||||
|
||||
private static class Decoder extends DoubleByteDecoder {
|
@ -27,20 +27,18 @@
|
||||
/*
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
|
||||
public class MS949
|
||||
public class MS949_OLD
|
||||
extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
|
||||
public MS949() {
|
||||
super("x-windows-949", ExtendedCharsets.aliasesFor("x-windows-949"));
|
||||
public MS949_OLD() {
|
||||
super("x-windows-949-OLD", null);
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
@ -49,7 +47,7 @@ public class MS949
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return ((cs.name().equals("US-ASCII"))
|
||||
|| (cs instanceof MS949));
|
||||
|| (cs instanceof MS949_OLD));
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
@ -70,16 +68,16 @@ public class MS949
|
||||
*/
|
||||
|
||||
public short[] getDecoderIndex1() {
|
||||
return MS949.Decoder.index1;
|
||||
return Decoder.index1;
|
||||
}
|
||||
public String[] getDecoderIndex2() {
|
||||
return MS949.Decoder.index2;
|
||||
return Decoder.index2;
|
||||
}
|
||||
public short[] getEncoderIndex1() {
|
||||
return MS949.Encoder.index1;
|
||||
return Encoder.index1;
|
||||
}
|
||||
public String[] getEncoderIndex2() {
|
||||
return MS949.Encoder.index2;
|
||||
return Encoder.index2;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2002-2003 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
@ -27,20 +26,18 @@
|
||||
/*
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
|
||||
public class MS950
|
||||
public class MS950_OLD
|
||||
extends Charset
|
||||
implements HistoricallyNamedCharset
|
||||
{
|
||||
|
||||
public MS950() {
|
||||
super("x-windows-950", ExtendedCharsets.aliasesFor("x-windows-950"));
|
||||
public MS950_OLD() {
|
||||
super("x-windows-950-OLD", null);
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
@ -49,7 +46,7 @@ public class MS950
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return ((cs.name().equals("US-ASCII"))
|
||||
|| (cs instanceof MS950));
|
||||
|| (cs instanceof MS950_OLD));
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
@ -70,19 +67,19 @@ public class MS950
|
||||
*/
|
||||
|
||||
public short[] getDecoderIndex1() {
|
||||
return MS950.Decoder.index1;
|
||||
return Decoder.index1;
|
||||
}
|
||||
|
||||
public String[] getDecoderIndex2() {
|
||||
return MS950.Decoder.index2;
|
||||
return Decoder.index2;
|
||||
}
|
||||
|
||||
public short[] getEncoderIndex1() {
|
||||
return MS950.Encoder.index1;
|
||||
return Encoder.index1;
|
||||
}
|
||||
|
||||
public String[] getEncoderIndex2() {
|
||||
return MS950.Encoder.index2;
|
||||
return Encoder.index2;
|
||||
}
|
||||
|
||||
protected static class Decoder extends DoubleByteDecoder {
|
@ -25,7 +25,7 @@
|
||||
* @test
|
||||
* @bug 6843578
|
||||
* @summary Test IBM DB charsets
|
||||
* @build IBM930_OLD IBM933_OLD IBM935_OLD IBM937_OLD IBM939_OLD IBM942_OLD IBM943_OLD IBM948_OLD IBM949_OLD IBM950_OLD IBM970_OLD IBM942C_OLD IBM943C_OLD IBM949C_OLD IBM1381_OLD IBM1383_OLD
|
||||
* @build IBM930_OLD IBM933_OLD IBM935_OLD IBM937_OLD IBM939_OLD IBM942_OLD IBM943_OLD IBM948_OLD IBM949_OLD IBM950_OLD IBM970_OLD IBM942C_OLD IBM943C_OLD IBM949C_OLD IBM1381_OLD IBM1383_OLD EUC_CN_OLD EUC_KR_OLD GBK_OLD Johab_OLD MS932_OLD MS936_OLD MS949_OLD MS950_OLD
|
||||
*/
|
||||
|
||||
import java.nio.charset.*;
|
||||
@ -36,7 +36,7 @@ public class TestIBMDB {
|
||||
static class Time {
|
||||
long t;
|
||||
}
|
||||
static int iteration = 100;
|
||||
static int iteration = 200;
|
||||
|
||||
static char[] decode(byte[] bb, Charset cs, boolean testDirect, Time t)
|
||||
throws Exception {
|
||||
@ -181,20 +181,21 @@ public class TestIBMDB {
|
||||
boolean canOld = encOLD.canEncode(c);
|
||||
boolean canNew = encNew.canEncode(c);
|
||||
|
||||
if (is970 && c == 0x2299)
|
||||
continue;
|
||||
if (is970 && c == 0x2299)
|
||||
continue;
|
||||
|
||||
if (canOld != canNew) {
|
||||
if (canNew) {
|
||||
System.out.printf(" NEW(only): ");
|
||||
printEntry(c, newCS);
|
||||
} else {
|
||||
if (is970) {
|
||||
byte[] bb = new String(new char[] {c}).getBytes(oldCS);
|
||||
if (bb.length == 2 && bb[0] == (byte)0xa2 && bb[1] == (byte)0xc1) {
|
||||
// we know 970 has bogus nnnn -> a2c1 -> 2299
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (is970) {
|
||||
byte[] bb = new String(new char[] {c}).getBytes(oldCS);
|
||||
if (bb.length == 2 && bb[0] == (byte)0xa2 && bb[1] == (byte)0xc1) {
|
||||
// we know 970 has bogus nnnn -> a2c1 -> 2299
|
||||
continue;
|
||||
}
|
||||
}
|
||||
System.out.printf(" OLD(only): ");
|
||||
printEntry(c, oldCS);
|
||||
}
|
||||
@ -240,8 +241,10 @@ if (is970) {
|
||||
String sOld = new String(bb, oldCS);
|
||||
String sNew = new String(bb, newCS);
|
||||
if (!sOld.equals(sNew)) {
|
||||
System.out.printf(" b=%x: %x %x%n",
|
||||
b& 0xff, sOld.charAt(0) & 0xffff, sNew.charAt(0) & 0xffff);
|
||||
System.out.printf(" b=%x: %x/%d(old) %x/%d(new)%n",
|
||||
b& 0xff,
|
||||
sOld.charAt(0) & 0xffff, sOld.length(),
|
||||
sNew.charAt(0) & 0xffff, sNew.length());
|
||||
}
|
||||
}
|
||||
|
||||
@ -250,6 +253,22 @@ if (is970) {
|
||||
int b1Min = 0x40;
|
||||
int b1Max = 0xfe;
|
||||
for (int b1 = 0x40; b1 < 0xff; b1++) {
|
||||
if (!isEBCDIC) {
|
||||
// decodable singlebyte b1
|
||||
bb[0] = (byte)b1;
|
||||
String sOld = new String(bb, oldCS);
|
||||
String sNew = new String(bb, newCS);
|
||||
if (!sOld.equals(sNew)) {
|
||||
if (sOld.length() != 2 && sOld.charAt(0) != 0) {
|
||||
// only prints we are NOT expected. above two are known issue
|
||||
System.out.printf(" b1=%x: %x/%d(old) %x/%d(new)%n",
|
||||
b1 & 0xff,
|
||||
sOld.charAt(0) & 0xffff, sOld.length(),
|
||||
sNew.charAt(0) & 0xffff, sNew.length());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int b2 = 0x40; b2 < 0xff; b2++) {
|
||||
if (isEBCDIC) {
|
||||
bb[0] = 0x0e;
|
||||
@ -268,7 +287,7 @@ if (is970) {
|
||||
if (sOld.charAt(0) == 0 && sNew.charAt(0) == 0xfffd)
|
||||
continue; // known issude in old implementation
|
||||
|
||||
System.out.printf(" bb=<%x,%x> %x, %x%n",
|
||||
System.out.printf(" bb=<%x,%x> c(old)=%x, c(new)=%x%n",
|
||||
b1, b2, sOld.charAt(0) & 0xffff, sNew.charAt(0) & 0xffff);
|
||||
}
|
||||
}
|
||||
@ -486,6 +505,15 @@ if (sOld.charAt(0) == 0 && sNew.charAt(0) == 0xfffd)
|
||||
"IBM949C",
|
||||
"IBM1381",
|
||||
"IBM1383",
|
||||
|
||||
"EUC_CN",
|
||||
"EUC_KR",
|
||||
"GBK",
|
||||
"Johab",
|
||||
"MS932",
|
||||
"MS936",
|
||||
"MS949",
|
||||
"MS950",
|
||||
};
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
133
jdk/test/sun/nio/cs/OLD/TestX11CS.java
Normal file
133
jdk/test/sun/nio/cs/OLD/TestX11CS.java
Normal file
@ -0,0 +1,133 @@
|
||||
/*
|
||||
* Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 1234567
|
||||
* @summary Test updated X11 charsets
|
||||
* @build X11GB2312_OLD X11GBK_OLD X11KSC5601_OLD
|
||||
*/
|
||||
|
||||
import java.nio.charset.*;
|
||||
import java.nio.*;
|
||||
import java.util.*;
|
||||
|
||||
public class TestX11CS {
|
||||
|
||||
static char[] decode(byte[] bb, Charset cs)
|
||||
throws Exception {
|
||||
CharsetDecoder dec = cs.newDecoder();
|
||||
ByteBuffer bbf = ByteBuffer.wrap(bb);
|
||||
CharBuffer cbf = CharBuffer.allocate(bb.length);
|
||||
CoderResult cr = dec.decode(bbf, cbf, true);
|
||||
if (cr != CoderResult.UNDERFLOW) {
|
||||
System.out.println("DEC-----------------");
|
||||
int pos = bbf.position();
|
||||
System.out.printf(" cr=%s, bbf.pos=%d, bb[pos]=%x,%x,%x,%x%n",
|
||||
cr.toString(), pos,
|
||||
bb[pos++]&0xff, bb[pos++]&0xff,bb[pos++]&0xff, bb[pos++]&0xff);
|
||||
throw new RuntimeException("Decoding err: " + cs.name());
|
||||
}
|
||||
char[] cc = new char[cbf.position()];
|
||||
cbf.flip(); cbf.get(cc);
|
||||
return cc;
|
||||
|
||||
}
|
||||
|
||||
static byte[] encode(char[] cc, Charset cs)
|
||||
throws Exception {
|
||||
ByteBuffer bbf = ByteBuffer.allocate(cc.length * 4);
|
||||
CharBuffer cbf = CharBuffer.wrap(cc);
|
||||
CharsetEncoder enc = cs.newEncoder();
|
||||
|
||||
CoderResult cr = enc.encode(cbf, bbf, true);
|
||||
if (cr != CoderResult.UNDERFLOW) {
|
||||
System.out.println("ENC-----------------");
|
||||
int pos = cbf.position();
|
||||
System.out.printf(" cr=%s, cbf.pos=%d, cc[pos]=%x%n",
|
||||
cr.toString(), pos, cc[pos]&0xffff);
|
||||
throw new RuntimeException("Encoding err: " + cs.name());
|
||||
}
|
||||
byte[] bb = new byte[bbf.position()];
|
||||
bbf.flip(); bbf.get(bb);
|
||||
return bb;
|
||||
}
|
||||
|
||||
static char[] getChars(Charset newCS, Charset oldCS) {
|
||||
CharsetEncoder enc = oldCS.newEncoder();
|
||||
CharsetEncoder encNew = newCS.newEncoder();
|
||||
char[] cc = new char[0x10000];
|
||||
int pos = 0;
|
||||
int i = 0;
|
||||
while (i < 0x10000) {
|
||||
if (enc.canEncode((char)i) != encNew.canEncode((char)i)) {
|
||||
System.out.printf(" Err i=%x%n", i);
|
||||
//throw new RuntimeException("canEncode() err!");
|
||||
}
|
||||
if (enc.canEncode((char)i)) {
|
||||
cc[pos++] = (char)i;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return Arrays.copyOf(cc, pos);
|
||||
}
|
||||
|
||||
static void compare(Charset newCS, Charset oldCS) throws Exception {
|
||||
System.out.printf(" Diff <%s> <%s>...%n", newCS.name(), oldCS.name());
|
||||
char[] cc = getChars(newCS, oldCS);
|
||||
|
||||
byte[] bb1 = encode(cc, newCS);
|
||||
byte[] bb2 = encode(cc, oldCS);
|
||||
|
||||
if (!Arrays.equals(bb1, bb2)) {
|
||||
System.out.printf(" encoding failed!%n");
|
||||
}
|
||||
char[] cc1 = decode(bb1, newCS);
|
||||
char[] cc2 = decode(bb1, oldCS);
|
||||
if (!Arrays.equals(cc1, cc2)) {
|
||||
for (int i = 0; i < cc1.length; i++) {
|
||||
if (cc1[i] != cc2[i]) {
|
||||
System.out.printf("i=%d, cc1=%x cc2=%x, bb=<%x%x>%n",
|
||||
i,
|
||||
cc1[i]&0xffff, cc2[i]&0xffff,
|
||||
bb1[i*2]&0xff, bb1[i*2+1]&0xff);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
System.out.printf(" decoding failed%n");
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
compare(new sun.awt.motif.X11GBK(),
|
||||
new X11GBK_OLD());
|
||||
|
||||
compare(new sun.awt.motif.X11GB2312(),
|
||||
new X11GB2312_OLD());
|
||||
|
||||
compare(new sun.awt.motif.X11KSC5601(),
|
||||
new X11KSC5601_OLD());
|
||||
|
||||
}
|
||||
}
|
134
jdk/test/sun/nio/cs/OLD/X11GB2312_OLD.java
Normal file
134
jdk/test/sun/nio/cs/OLD/X11GB2312_OLD.java
Normal file
@ -0,0 +1,134 @@
|
||||
/*
|
||||
* Copyright 1996-2005 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Sun designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Sun in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
*/
|
||||
|
||||
import java.nio.CharBuffer;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.*;
|
||||
import sun.nio.cs.ext.EUC_CN;
|
||||
|
||||
public class X11GB2312_OLD extends Charset {
|
||||
public X11GB2312_OLD () {
|
||||
super("X11GB2312-OLD", null);
|
||||
}
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new Encoder(this);
|
||||
}
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new Decoder(this);
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return cs instanceof X11GB2312_OLD;
|
||||
}
|
||||
|
||||
private class Encoder extends EUC_CN_OLD.Encoder {
|
||||
public Encoder(Charset cs) {
|
||||
super(cs);
|
||||
}
|
||||
|
||||
public boolean canEncode(char c) {
|
||||
if (c <= 0x7F) {
|
||||
return false;
|
||||
}
|
||||
return super.canEncode(c);
|
||||
}
|
||||
|
||||
protected CoderResult encodeLoop(CharBuffer src, ByteBuffer dst) {
|
||||
char[] sa = src.array();
|
||||
int sp = src.arrayOffset() + src.position();
|
||||
int sl = src.arrayOffset() + src.limit();
|
||||
|
||||
byte[] da = dst.array();
|
||||
int dp = dst.arrayOffset() + dst.position();
|
||||
int dl = dst.arrayOffset() + dst.limit();
|
||||
|
||||
try {
|
||||
while (sp < sl) {
|
||||
char c = sa[sp];
|
||||
if (c <= '\u007f')
|
||||
return CoderResult.unmappableForLength(1);
|
||||
int ncode = encodeDouble(c);
|
||||
if (ncode != 0 && c != '\u0000' ) {
|
||||
da[dp++] = (byte) ((ncode >> 8) & 0x7f);
|
||||
da[dp++] = (byte) (ncode & 0x7f);
|
||||
sp++;
|
||||
continue;
|
||||
}
|
||||
return CoderResult.unmappableForLength(1);
|
||||
}
|
||||
return CoderResult.UNDERFLOW;
|
||||
} finally {
|
||||
src.position(sp - src.arrayOffset());
|
||||
dst.position(dp - dst.arrayOffset());
|
||||
}
|
||||
}
|
||||
public boolean isLegalReplacement(byte[] repl) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private class Decoder extends EUC_CN_OLD.Decoder {
|
||||
public Decoder(Charset cs) {
|
||||
super(cs);
|
||||
}
|
||||
|
||||
protected CoderResult decodeLoop(ByteBuffer src, CharBuffer dst) {
|
||||
byte[] sa = src.array();
|
||||
int sp = src.arrayOffset() + src.position();
|
||||
int sl = src.arrayOffset() + src.limit();
|
||||
assert (sp <= sl);
|
||||
sp = (sp <= sl ? sp : sl);
|
||||
char[] da = dst.array();
|
||||
int dp = dst.arrayOffset() + dst.position();
|
||||
int dl = dst.arrayOffset() + dst.limit();
|
||||
assert (dp <= dl);
|
||||
dp = (dp <= dl ? dp : dl);
|
||||
|
||||
try {
|
||||
while (sp < sl) {
|
||||
if ( sl - sp < 2) {
|
||||
return CoderResult.UNDERFLOW;
|
||||
}
|
||||
int b1 = sa[sp] & 0xFF | 0x80;
|
||||
int b2 = sa[sp + 1] & 0xFF | 0x80;
|
||||
char c = decodeDouble(b1, b2);
|
||||
if (c == replacement().charAt(0)) {
|
||||
return CoderResult.unmappableForLength(2);
|
||||
}
|
||||
if (dl - dp < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
da[dp++] = c;
|
||||
sp +=2;
|
||||
}
|
||||
return CoderResult.UNDERFLOW;
|
||||
} finally {
|
||||
src.position(sp - src.arrayOffset());
|
||||
dst.position(dp - dst.arrayOffset());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1998-2003 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 1999-2005 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -23,22 +23,34 @@
|
||||
* have any questions.
|
||||
*/
|
||||
|
||||
package sun.io;
|
||||
|
||||
import sun.nio.cs.ext.MS932DB;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import sun.nio.cs.ext.GBK;
|
||||
|
||||
/**
|
||||
* Tables and data to convert MS932 to Unicode
|
||||
*
|
||||
* @author ConverterGenerator tool
|
||||
*/
|
||||
public class X11GBK_OLD extends Charset {
|
||||
public X11GBK_OLD () {
|
||||
super("X11GBK-OLD", null);
|
||||
}
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new Encoder(this);
|
||||
}
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new GBK_OLD.Decoder(this);
|
||||
}
|
||||
|
||||
abstract class ByteToCharMS932DB extends ByteToCharDoubleByte {
|
||||
public boolean contains(Charset cs) {
|
||||
return cs instanceof X11GBK_OLD;
|
||||
}
|
||||
|
||||
public ByteToCharMS932DB() {
|
||||
super.index1 = MS932DB.Decoder.index1;
|
||||
super.index2 = MS932DB.Decoder.index2;
|
||||
start = 0x40;
|
||||
end = 0xFC;
|
||||
private class Encoder extends GBK_OLD.Encoder {
|
||||
public Encoder(Charset cs) {
|
||||
super(cs);
|
||||
}
|
||||
public boolean canEncode(char ch){
|
||||
if (ch < 0x80) return false;
|
||||
return super.canEncode(ch);
|
||||
}
|
||||
}
|
||||
}
|
133
jdk/test/sun/nio/cs/OLD/X11KSC5601_OLD.java
Normal file
133
jdk/test/sun/nio/cs/OLD/X11KSC5601_OLD.java
Normal file
@ -0,0 +1,133 @@
|
||||
/*
|
||||
* Copyright 1996-2005 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Sun designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Sun in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
*/
|
||||
|
||||
import java.nio.CharBuffer;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.*;
|
||||
import sun.nio.cs.ext.EUC_KR;
|
||||
|
||||
public class X11KSC5601_OLD extends Charset {
|
||||
public X11KSC5601_OLD () {
|
||||
super("X11KSC5601-OLD", null);
|
||||
}
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new Encoder(this);
|
||||
}
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new Decoder(this);
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return cs instanceof X11KSC5601_OLD;
|
||||
}
|
||||
|
||||
private class Encoder extends EUC_KR_OLD.Encoder {
|
||||
public Encoder(Charset cs) {
|
||||
super(cs);
|
||||
}
|
||||
|
||||
public boolean canEncode(char c) {
|
||||
if (c <= 0x7F) {
|
||||
return false;
|
||||
}
|
||||
return super.canEncode(c);
|
||||
}
|
||||
|
||||
protected CoderResult encodeLoop(CharBuffer src, ByteBuffer dst) {
|
||||
char[] sa = src.array();
|
||||
int sp = src.arrayOffset() + src.position();
|
||||
int sl = src.arrayOffset() + src.limit();
|
||||
byte[] da = dst.array();
|
||||
int dp = dst.arrayOffset() + dst.position();
|
||||
int dl = dst.arrayOffset() + dst.limit();
|
||||
|
||||
try {
|
||||
while (sp < sl) {
|
||||
char c = sa[sp];
|
||||
if (c <= '\u007f')
|
||||
return CoderResult.unmappableForLength(1);
|
||||
int ncode = encodeDouble(c);
|
||||
if (ncode != 0 && c != '\u0000' ) {
|
||||
da[dp++] = (byte) ((ncode >> 8) & 0x7f);
|
||||
da[dp++] = (byte) (ncode & 0x7f);
|
||||
sp++;
|
||||
continue;
|
||||
}
|
||||
return CoderResult.unmappableForLength(1);
|
||||
}
|
||||
return CoderResult.UNDERFLOW;
|
||||
} finally {
|
||||
src.position(sp - src.arrayOffset());
|
||||
dst.position(dp - dst.arrayOffset());
|
||||
}
|
||||
}
|
||||
public boolean isLegalReplacement(byte[] repl) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private class Decoder extends EUC_KR_OLD.Decoder {
|
||||
public Decoder(Charset cs) {
|
||||
super(cs);
|
||||
}
|
||||
|
||||
protected CoderResult decodeLoop(ByteBuffer src, CharBuffer dst) {
|
||||
byte[] sa = src.array();
|
||||
int sp = src.arrayOffset() + src.position();
|
||||
int sl = src.arrayOffset() + src.limit();
|
||||
assert (sp <= sl);
|
||||
sp = (sp <= sl ? sp : sl);
|
||||
char[] da = dst.array();
|
||||
int dp = dst.arrayOffset() + dst.position();
|
||||
int dl = dst.arrayOffset() + dst.limit();
|
||||
assert (dp <= dl);
|
||||
dp = (dp <= dl ? dp : dl);
|
||||
|
||||
|
||||
try {
|
||||
while (sp < sl) {
|
||||
if ( sl - sp < 2) {
|
||||
return CoderResult.UNDERFLOW;
|
||||
}
|
||||
int b1 = sa[sp] & 0xFF | 0x80;
|
||||
int b2 = sa[sp + 1] & 0xFF | 0x80;
|
||||
char c = decodeDouble(b1, b2);
|
||||
if (c == replacement().charAt(0)) {
|
||||
return CoderResult.unmappableForLength(2);
|
||||
}
|
||||
if (dl - dp < 1)
|
||||
return CoderResult.OVERFLOW;
|
||||
da[dp++] = c;
|
||||
sp +=2;
|
||||
}
|
||||
return CoderResult.UNDERFLOW;
|
||||
} finally {
|
||||
src.position(sp - src.arrayOffset());
|
||||
dst.position(dp - dst.arrayOffset());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user