-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhcar.java
More file actions
33 lines (30 loc) · 692 Bytes
/
hcar.java
File metadata and controls
33 lines (30 loc) · 692 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package character;
import java.io.UnsupportedEncodingException;
public class hcar {
public static void main(String[] args){
String a="Ëü";
byte[] by=a.getBytes();
byte[] byutf;
try {
byutf = a.getBytes("utf-8");
for(byte b:by){
System.out.print(b);
}
System.out.println();
for(byte b2:byutf){
System.out.print(b2);
}
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println();
try {
String b=new String(a.getBytes("gbk"),"gbk");
System.out.println(b);
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}