Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Output encoding: UTF-8

 
Bernd Elsner
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there! - I'm using a servlet to generate and output a string resulting from an XSLT transformation. The problem is, that in the web browser those ugly "?" marks will appear.

I'm quite experienced with character encodings and XSLT transformations (mainly on Windows - this is on Linux -, using .NET instead of Java, but have used XSLT transformations with Java, too), but this is the first time I'm using this with Java web applications.
Of course, I've set

before outputting the result.

I could, of course, post the code (either in snippets or upload the complete project somewhere), but I thought you wouldn't handle this.
It's, I currently have no clue how to continue... I.e., how to debug this, and where to start.

I would really appreciate some guys to subscribe to this question, and would be willing to post the code, etc., and everything until this issue will be solved.

Thanks, indeed
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

A couple of points to investigate:
  • Is the page that arrives in your browser actually in UTF-8?
  • Does the page display correctly if you change the encoding in the browser to something else?
  • Does the font you use in the page contain the characters that appear as "?" ?

  •  
    Bernd Elsner
    Greenhorn
    Posts: 3
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    These are good questions. Thanks.
    Is the page that arrives in your browser actually in UTF-8?

    If I would only know that!!

    I've removed the Java command response.setCharacterEncoding and the HTML tag <meta http-equiv="Content-Type" content="text/html; charset=utf-8">, too, and saved the resulting HTML file, locally.

    In Firefox, after opening the file, the character set is set to UTF-8. When I change that in Firefox's menu, it will not have changed but will still be UTF-8.

    In Opera, the file will display well if I set the encoding to ISO-8859-1.

    That's absolutely strange as my whole system is setup to use UTF-8 per default!
    Does the page display correctly if you change the encoding in the browser to something else?

    Yes, please see above.
    Does the font you use in the page contain the characters that appear as "?" ?

    This is sans-serif, and the page can display correctly.
     
    Bernd Elsner
    Greenhorn
    Posts: 3
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    This problem is solved.

    I believe most of the confusion is due to the fact that I'm still unsure on how to make Tomcat actually reload the webapp from Eclipse.

    Thanks for assisting me!
     
    Don't get me started about those stupid light bulbs.
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic