URL编码解决中文乱码

String s="测试ss";
s=java.net.URLEncoder.encode(s,"UTF-8");
System.out.println(s);

s=java.net.URLDecoder.decode(s,"UTF-8");
System.out.println(s);

控制台输出:
%E6%B5%8B%E8%AF%95ss
测试ss

猜你喜欢

转载自cuityang.iteye.com/blog/2247634
今日推荐