首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 开源软件 >

nutch网页快照乱码解决办法

2012-07-08 
nutch网页快照乱码解决方法??ParseData ParseData bean.getParseData(details)String content nullS

nutch网页快照乱码解决方法

?

?

ParseData ParseData = bean.getParseData(details); String content = null; String contentType = ParseData.getMeta(Metadata.CONTENT_TYPE); if (contentType.startsWith("text/html")) { // FIXME : it's better to emit the original 'byte' sequence // with 'charset' set to the value of 'CharEncoding', // but I don't know how to emit 'byte sequence' in JSP. // out.getOutputStream().write(bean.getContent(details)) may work, // but I'm not sure. String encoding = ParseData.getMeta("CharEncodingForConversion"); if (encoding != null) { try { content = new String(bean.getContent(details), encoding); } catch (UnsupportedEncodingException e) { // fallback to windows-1252 content = new String(bean.getContent(details), "windows-1252"); } } else content = new String(bean.getContent(details),"GBK"); }?

热点排行