您的位置:首页 > 其它

String fname="%e6%8e%88%e6%9d%832"; url转码成中文

2016-08-12 10:05 344 查看
http://tool.chinaz.com/tools/urlencode.aspx    今天同事遇到的,如果是对方ecode,我直接decode就行,

知道对方怎么编码我们就能知道怎么解码了

import java.io.UnsupportedEncodingException;

import java.net.URLDecoder;

import java.net.URLEncoder;

public class test {

public static void main(String[] args) {
String fname=""+"&K17&"+"&lsSZVAR_KJQJ="+"&K18&"+"&lsS%E5%8F%96%E6%95%B0%E4%BC%9A%E8%AE%A1%E5%B9%B4%E5%BA%A6%EF%BC%9A="+"&K19&"+"&lsS%E5%8F%96%E6%95%B0%E4%BC%9A%E8%AE%A1%E6%9C%9F%E9%97%B4%EF%BC%9A="+"&K20&"+"&lsS%E4%BC%9A%E8%AE%A1%E5%B9%B4%E5%BA%A6="+"&K21&"+"&lsS%E4%BC%9A%E8%AE%A1%E6%9C%9F%E9%97%B4=&K22";
//将utf-8格式的中文转换成URL编码
 
//将URL编码的字符串转换成utf-8格式的中文
try {
String decodeFName = URLDecoder.decode(fname, "utf-8");
System.out.println(decodeFName);
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐