wood burning stoves 2.0*
The moose likes Servlets and the fly likes Output encoding: UTF-8 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Output encoding: UTF-8" Watch "Output encoding: UTF-8" New topic
Author

Output encoding: UTF-8

Bernd Elsner
Greenhorn

Joined: Aug 22, 2006
Posts: 3
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
Marshal

Joined: Mar 22, 2005
Posts: 41047
    
  43
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 "?" ?


  • Ping & DNS - my free Android networking tools app
    Bernd Elsner
    Greenhorn

    Joined: Aug 22, 2006
    Posts: 3
    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

    Joined: Aug 22, 2006
    Posts: 3
    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!
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Output encoding: UTF-8
     
    Similar Threads
    Comparing RIA technologies
    XML Parsers
    struts turbine and cocoon
    Fun (well, not really..) with character encoding
    JSP Submit from java code