1 //Short start = (short) 0xb0a0;2 ShortStart = ( Short) 0xa1a0;3 //GBK gb2312 Big5 gb180304String encoder = "gb2312";5 6Bytearrayoutputstream Bytearrayos =NewBytearrayoutputstream ();7DataOutputStream Dataos =NewDataOutputStream (bytearrayos);8 9 for( ShortK = 0x00; K < 0x5700; K + = 0x100){Ten for( Shortj = 0x00; J < 0x60; J + = 0x10){ One for( Shorti = 0x00; i < 0x10; i + = 0x01){ ADataos.writeshort (start + i + j +k); - //Write a space -Dataos.write ("". GetBytes (encoder)); the } -Dataos.write ("\n\r". GetBytes (encoder)); - } -Dataos.write ("\n\r". GetBytes (encoder)); + } - +System.out.println (bytearrayos.tostring (encoder));
Unicode, UTF-8, GBK Mutual transfer
Unicode is not linearly related to GBK encoding, and Unicode is encoded in the order of the glyphs (strokes: Portrait-by-point), while gbk,gb2312,gb18030 is encoded in the order of pinyin
So the conversion of Unicode and GBK encoding can only be converted by the comparison table:
Printing Chinese characters with programs