According to the supplementary question in the previous article http://blog.csdn.net/fancylovejava/article/details/10142391
With an understanding of the previous article, I probably know the Unicode encoding format.
ANSI: The inner code range of the Chinese character area is high byte from B0-f7, low byte from A1-fe
Unicode: The Unicode encoding range for Chinese characters is \u4e00-\u9fa5 \uf900-\ufa2d, which is not a Chinese character if it is not within this range.
The problem with the program now is that when the server sends the Chinese to the Android client, the Android client gets the string and displays it to the interface, but the result is
Unicode encoding Format & #24320;& #22987;& #20817;& #22870; So, it's going to change.
There are related website tools for converting Unicode encoding and ASICC encoding, http://tool.chinaz.com/Tools/Unicode.aspx
JDK has a tool also provides conversion, is Native2ascii.exe, under the Bin directory, directly open input Chinese can be
There is a better article about http://sailinglee.iteye.com/blog/430568
But we will be in the process of these & #24320, converted into Chinese AH ~ ~ ~
String a= "Start redeeming";
System.out.println (A.codepointat (0));
This printed out is the "open" character of the & #24320; Unicode number part 24320
System.out.println ((char) 24320);
This printout is to convert a number to a char type, which is a Chinese character representing the Unicode code.
Print out the result: open
With this, you can convert Unicode into Chinese.
There is an article very good, turn around http://blog.csdn.net/ocean20/article/details/6743385 description under Char this character type in Java
Char in Java takes up a few bytes
1: "Byte" is byte, "bit" is bit;
2:1 byte = 8 bit;
Char is 2 bytes in Java. Java uses unicode,2 bytes (16 bits) to represent one character.
The example code is as follows:
[Java]View Plaincopy
- Public class Test {
- public static void Main (string[] args) {
- String str= "Medium";
- char x =' Medium ';
- byte[] bytes=null;
- byte[] bytes1=null;
- try {
- bytes = Str.getbytes ("Utf-8");
- Bytes1 = Chartobyte (x);
- } catch (Unsupportedencodingexception e) {
- //TODO auto-generated catch block
- E.printstacktrace ();
- }
- System.out.println ("bytes Size:" +bytes.length);
- System.out.println ("bytes1 size:" +bytes1.length);
- }
- public static byte[] Chartobyte (char c) {
- byte[] B = new byte[2];
- b[0] = (byte) ((C & 0xff00) >> 8);
- b[1] = (byte) (C & 0xFF);
- return B;
- }
- }
Operation Result:
Bytes Size: 3
Bytes1 Size: 2
Java is a Unicode representation of a character, and the Unicode of the Chinese character "medium" is 2 bytes.
The String.getbytes (encoding) method is to get a byte array representation of the specified encoding,
typically gbk/gb2312 is 2 bytes, and Utf-8 is 3 bytes .
If you do not specify encoding, the system default encoding is taken.
Java program implements Unicode code and Chinese to convert each other