The characters which are in the feed are UTF-8 encoded characters , where as by default the tomcat server assume that all the characters are encoded in ISO-8859-1
as the result Tomcat is trying to read the characters in the feed (which are UTF-8 encoded) in ISO-8859-1 encoded format because of which it could not able to print the international character's.
How to resolve? ~~~~~~~~~~~~~~~ we need to say to the java servlet that those characters are UTF-8 and are not the default ISO encoded
How to say? ~~~~~~~~~~ URL ffeedurl = new URL(feedurl); HttpURLConnection.setFollowRedirects(true); URLConnection connection = ffeedurl.openConnection(); HttpURLConnection httpConnection = (HttpURLConnection) connection;
Please observe the below line the second argument of InputStreamReader constructor ....................it is UTF-8 which say to the servlet that characters retrieved from the URL are UTF-8 Encoded are not encoded in the default ISO format
InputStreamReader defaultReader = new InputStreamReader(httpConnection.getInputStream(),"UTF-8");
That's it. in adddition to that you need to take care of the below things.
1) mysql connection should be as below jdbc:mysql://localhost/databasename?useEncoding=true&characterEncoding=UTF-8 instead of jdbc:mysql://localhost/databasename
2) in mysql database , each table , each text/varchar column should be of UTF-8-general-ci
3) if you are using log4j and want ot see the UTF-8 characters in the log messages you should add the below param to each appender <param name="Encoding" value="UTF-8"/> (i don't know even after setting this i couldnot able to see the characters properly in log file/console)