最近读取一个韩文网站,发现采下的内容全是乱码,不知道怎么解决退请各位支招下。此处就拿三星网站例说:打开http://www.samsung.com/sec/#mobile-devices-home 可以查看到网站编码是utf-8
这里java采集数据以utf-8去读取时发现采下的内容韩文全是乱码httpclient抓取的部分代码:
uefEntity = new UrlEncodedFormEntity(new ArrayList<NameValuePair>(),encoding);
post = new HttpPost(url);
post.setEntity(uefEntity);
post.setHeaders(headers);
response = httpClient.execute(post);
entity = response.getEntity(); // 获取响应实体
if (null != entity) {
result = EntityUtils.toString(entity, encoding);
}
此处encoding传的为utf-8采集中文网站一切正常,请问下韩文要以什么编码进行采集还是要特殊处理?
这里java采集数据以utf-8去读取时发现采下的内容韩文全是乱码httpclient抓取的部分代码:
uefEntity = new UrlEncodedFormEntity(new ArrayList<NameValuePair>(),encoding);
post = new HttpPost(url);
post.setEntity(uefEntity);
post.setHeaders(headers);
response = httpClient.execute(post);
entity = response.getEntity(); // 获取响应实体
if (null != entity) {
result = EntityUtils.toString(entity, encoding);
}
此处encoding传的为utf-8采集中文网站一切正常,请问下韩文要以什么编码进行采集还是要特殊处理?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货