字符编码问题

UTF-8  GBK 是中文字符 二进制 存储层面的问题

url-encode   / http层 应用层,在浏览器与服务端交互时需考虑;在服务器与服务器时则不要考虑;

浏览器使用$.ajax()发送中文字符时,处理过程:中文字符--->对应的字符编码表示----> 进行urlencode

 

 public static void main(String[] args) throws Exception{

	   String strTest = "中文";
	   strTest = URLEncoder.encode(strTest, "UTF-8");
	   System.out.println(strTest);
	   strTest = URLDecoder.decode(strTest,"UTF-8");
	   System.out.println(strTest);
 }

  

posted on 2015-04-03 16:24  majia1949  阅读(162)  评论(0编辑  收藏  举报

导航