如果
String testStr=URLDecoder.decode("%E6%B5%8B%E8%AF%95%E6%8E%A5%E5%8F%A3","utf-8");
则testStr="测试接口"
否则如果
String testStr=URLDecoder.decode("%E6%B5%8B%E8%AF%95%E6%8E%A5%E5%8F%A3","gb2312");
则testStr=“娴?璇???ュ?? ”问:
采用第二种方式之后,如何把testStr中的乱码还原,即="测试接口"
String testStr=URLDecoder.decode("%E6%B5%8B%E8%AF%95%E6%8E%A5%E5%8F%A3","utf-8");
则testStr="测试接口"
否则如果
String testStr=URLDecoder.decode("%E6%B5%8B%E8%AF%95%E6%8E%A5%E5%8F%A3","gb2312");
则testStr=“娴?璇???ュ?? ”问:
采用第二种方式之后,如何把testStr中的乱码还原,即="测试接口"
"%E6%B5%8B%E8%AF%95%E6%8E%A5%E5%8F%A3",如果以"gb2312"来解码肯定结果不同(解码后的?说明了有些字符在gb2312编码下是无法显示的),如果原来是这样的字符串:"测试接口",那经过两次转变之后还是有可能还原的
http://www.regexlab.com/zh/encoding.htm