Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP displays special characters from database as question marks  RSS feed

Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!