I have tried parsing some Turkish web pages with Jsoup into a Spring MVC project. But I get some some utf-8 encoding problems. Parsed elements are going to save, not send to jsp pages.
Document document = Jsoup.connect(mainurl).get();
Elements newsList = document.select(".one_all_news");
for(Element news : newsList){
Element head = news.select(".one_all_news_title").first().select("a").first();
String title = head.text() ;
// String url = head.attr("abs:href");
System.out.println(title);
}
And output is : ��al���ma-Y��l��-Țren-Tarihleri
but it should be like this : Çalışma-Yılı-Tören-Tarihleri
I also used these for connection
Document document = Jsoup.parse(new URL(url).openStream(), "ISO-8859-9", url);
Document document = Jsoup.parse(new URL(url).openStream(), "UTF-8", url);
But result is same as.
Also i add this filter to web.xml
<filter>
<filter-name>characterEncodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>characterEncodingFilter</filter-name>
<url-pattern>/</url-pattern>
</filter-mapping>
Thanks for help.