I have written two methods one is for Jsoup GET and another one is for POST.
The methods are as follows
GET method :
public static Document getJsoupDocumentGET(String url) throws Exception {
LOGGER.info("Start : Inside JsoupURLUtil.getJsoupDocumentGET()");
LOGGER.info("URL : " + url);
final Document document = Jsoup.connect(url)
.header("Content-Type", "text/html;charset=EUC-KR;language=euc-kr")
.header("Accept-Encoding", "gzip,deflate,sdch;euc-kr")
.header("Accept-Language", "euc-kr")
.userAgent(USER_AGENT).get();
LOGGER.info("End : Inside JsoupURLUtil.getJsoupDocumentGET()");
return document;
}
POST method :
public static Document getJsoupDocumentPOST(String url, Map<String, String> parameterMap) throws Exception {
LOGGER.info("Start : Inside JsoupURLUtil.getJsoupDocumentPOST()");
LOGGER.info("URL : " + url);
final Document document = Jsoup.connect(url).data(parameterMap)
.header("Content-Type", "text/html;charset=EUC-KR;language=euc-kr")
.header("Accept-Encoding", "gzip,deflate,sdch;euc-kr")
.header("Accept-Language", "euc-kr")
.userAgent(USER_AGENT).post();
LOGGER.info("End : Inside JsoupURLUtil.getJsoupDocumentPOST()");
return document;
}
These two methods will return the jsoup Document.
But the problem is, the returned document is not properly encoded characters.
output document always contains some junk data like this which are should be the Korean Character.
��õ����(��)�� �����Ͽ����ϴ�.
So what will be the solution for this.
Thanking in advance.