JDK (Java Development Kit) Tutorials
Dr. Herong Yang, Version 5.00

Running EncodingSampler.java with GB18030

This section provides a tutorial example on how to run the character encoding sample program with GB18030, which is the newest Chinese character set encoding.

Finally, I want to try an encoding related to Chinese characters, GB18030:

GB18030 encoding:
Char, String, Writer, Charset, Encoder
0000, 00, 00, 00, 00
003F, 3F, 3F, 3F, 3F
0040, 40, 40, 40, 40
007F, 7F, 7F, 7F, 7F
0080, 81 30 81 30, 81 30 81 30, 81 30 81 30, 81 30 81 30
00BF, 81 30 86 37, 81 30 86 37, 81 30 86 37, 81 30 86 37
00C0, 81 30 86 38, 81 30 86 38, 81 30 86 38, 81 30 86 38
00FF, 81 30 8B 37, 81 30 8B 37, 81 30 8B 37, 81 30 8B 37
0100, 81 30 8B 38, 81 30 8B 38, 81 30 8B 38, 81 30 8B 38
3FFF, 82 32 A6 36, 82 32 A6 36, 82 32 A6 36, 82 32 A6 36
4000, 82 32 A6 37, 82 32 A6 37, 82 32 A6 37, 82 32 A6 37
7FFF, C2 52, C2 52, C2 52, C2 52
8000, D2 AB, D2 AB, D2 AB, D2 AB
BFFF, 83 31 D7 34, 83 31 D7 34, 83 31 D7 34, 83 31 D7 34
C000, 83 31 D7 35, 83 31 D7 35, 83 31 D7 35, 83 31 D7 35
EFFF, 83 38 96 36, 83 38 96 36, 83 38 96 36, 83 38 96 36
F000, 83 38 96 37, 83 38 96 37, 83 38 96 37, 83 38 96 37
FFFF, 84 31 A4 39, 84 31 A4 39, 84 31 A4 39, 84 31 A4 39

The output of Chinese character encoding GB18030 seems to be very complicate.

I think I have tested enough with my sample program, EncodingSampler.java. You can run the program with any of the supported encodings as an argument yourself.

Last update: 2006.

Sections in This Chapter

What Is Character Encoding?

Supported Character Encodings in JDK

Charset.encode() - Method to Encode Characters

Running EncodingSampler.java with CP1252 Encoding

Running EncodingSampler.java with ISO-8859-1 and US-ASCII

Running EncodingSampler.java with UTF-8, UTF-16, UTF16-BE

Running EncodingSampler.java with GB18030

Charset.decode() - Method to Decode Byte Sequences

Dr. Herong Yang, updated in 2008
Running EncodingSampler.java with GB18030