import java.io.UnsupportedEncodingException;
import java.util.Arrays;
public class Test {
public static void main(String [] args)throws UnsupportedEncodingException {
//
String str =“王五”;
// URI的编码:原理:
//(1)获得字节数组: 使用utf-8进行编码:
byte [] bytes = str.getBytes(“utf-8”);
的System.out.println(Arrays.toString(字节));
// [-25,-114,-117,-28,-70,-108]
// bytes每个值:加上256
// [231,142,139,228,186,148];
//获得十六进制:
// [E7,8E,8b,E4,ba,94];
// [%E7,%8E,%8b,%E4,%ba,%94];
// [%E7,%8E,%8B,%E4,%BA,%94]
}
}