paip.51cto HTML转码规则

 

paip.51cto HTML转码规则

开发款51CTP的博客发送程序,使用HTTPCLIENT ,发现标准的HTML转码文件内容发送不上去。。。

经过和LIVER WRITER抓码对比。。发现了对HTML转码有所不同。。对双引号和空格不进行转码,保持原样..

 


public static String html(String content) {
    if(content==null) return "";       
       String html = content;
       
   //    html = html.replace( "'", "'");
        html = html.replaceAll( "&", "&");
     //   html = html.replace( "\"", """);  //"
        html = html.replace( "\t", "  ");// 替换跳格
  //      html = html.replace( " ", " ");// 替换空格
        html = html.replace("<", "&lt;");
   
        html = html.replaceAll( ">", "&gt;");
     
      
       return html;
    }

posted @ 2012-07-16 20:57  attilaxAti  阅读(43)  评论(0编辑  收藏  举报