This week's book giveaway is in the Testing forum. We're giving away four copies of The Way of the Web Tester: A Beginner's Guide to Automating Tests and have Jonathan Rasmusson on-line! See this thread for details.
JSP displays special characters from database as question marks
posted 6 years ago
Apologies if this issue was solved before, I just couldn't find the thread.
Anyway, I am trying to display rows from Oracle 10g database on my JSP page ran via Tomcat. However, characters š,č,ć,đ and ž show up as "?"s.
I tried fetching the same rows from a regular Java class and writing them in a file via PrintWriter, and it works ok. Or at least it prints them up as special characters, I have to set up the charset to UTF-16 if I want to get the ones I need. But ultimately I end up with a text file with all the characters I need.
However when I want to display the same rows via JSP, all the special characters are simply question marks. Regular HTML that includes those special characters displays them fine, so it's not an issue of correct META tag.
Any advice would be very much appreciated, since my app is currently pretty much unpresentable, and my deadlines are so damn near...
Thanks in advance. Cheers!
Edit: response.setContentType("text/html; charset=UTF-8"); did the trick. Thanks!