......int data = 0;
while((data=System.in.read())!=-1)
Sysout.out.println(Integer.toHexString(data));
.......
若file.encoding为GBK,为什么程序中输出的是GBK码,在data中存的不是Unicode所对应的值吗?
while((data=System.in.read())!=-1)
Sysout.out.println(Integer.toHexString(data));
.......
若file.encoding为GBK,为什么程序中输出的是GBK码,在data中存的不是Unicode所对应的值吗?
假如输入的是"中",那么read()方法先读取低字节的部分(GBK码)到data中(按GBK编码为Unicode码),然后在解码为GBK码.高字节也是相同的方式,所以结果为GBK码.
Unicode不就是用是用4位16进制表示的吗?