|
|
|
联系客服020-83701501

xss遇到的utf-7编码转utf-8编码示例

联系在线客服,可以获得免费在线咨询服务。 QQ咨询 我要预约
xss遇到的utf-7编码转utf-8编码示例

在一个xss标题中遇到的这个编码问题,utf-7和mutf-7这个编码是邮件独霸的,javamail该当支持,独霸utf-7这个还是对照少 见的编码也许截至一些xss独霸。独霸原生jdk会报不支持utf-7编码的舛讹,这是sun jdk的bug。开源的jcharset.jar是个贪图操持。将此jar包buildpath以后,便也许独霸了。写了一个小步伐模范,将编码转夙昔!

Default
123456789101112131415161718192021222324 public static void main(String[] args) { //将要原义的utf-7编码名堂的写在bf里,将在d盘以utf-8名堂写出一个txt //结构stringbuffer StringBuffer bf = new StringBuffer("+ADwAcwBjAHIAaQBwAHQAPgB3AGkAbgBkAG8AdwAuAGwAbwBjAGEAdABpAG8AbgAuAGgAcgBlAGYAPQAiAHUAdABmAC0ANwAuAHAAaABwACIAPAAvAHMAYwByAGkAcAB0AD4-"); try { OutputStream outputStream = new FileOutputStream("d:\\utf-8.txt"); OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream,"utf-8"); //闪现文件被用甚么名堂编码 //System.out.println(outputStreamWriter.getEncoding()); //io流的写出 BufferedWriter bufferedWriter = new BufferedWriter(outputStreamWriter); bufferedWriter.write(new String(bf.toString().getBytes("utf-8"),"utf-7")); bufferedWriter.flush(); bufferedWriter.close(); bufferedWriter = null; } catch (FileNotFoundException e) { e.printStackTrace(); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); }

必要的jcharset-1_5下载.

link:http://blog.apt-get.cn/?p=139

本文由Internet安全攻防研讨室(www.91ri.org)动静安全小组收集整理,转载请阐明来因。

数安新闻+更多

证书相关+更多