JBoss, Struts and UTF-8

From: Electric Natcho (electric_natcho_at_hotmail.com)
Date: 11/29/03


Date: 28 Nov 2003 16:40:46 -0800

Hi, I'm working on an internationalized application using JBoss 3.2
(with Tomcat 4.1), IIS and Struts 1.1. We want to return utf-8 encoded
pages to ensure our responses can support many languages. It is my
understanding that we should be able to tell Java how to encode our
responses and it will handle all of the encoding for us (so we don't
have to worry about individually encoding every resource, jsp,
includes etc).

To set the encoding to utf-8, I've done the following:
1) assigned the encoding within the controller options in
struts-config:
        <controller contentType="text/html;charset=UTF-8"
                nocache="true"
                processorClass="org.apache.struts.action.RequestProcessor" />
2) included a jsp page directive
        <%@ page contentType="text/html;charset=UTF-8" pageEncoding="utf-8"
%>
3) included a meta tag within the html page itself
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        This won't encode the response but it should help the browser detect
the encoding.
        
I'm aware that the encoding can only be set in the response before
writing to the underlying Writer (since it would not be smart to
change the encoding during a response).

What's the best way to ensure the encoding is working properly? I've
viewed my pages using Opera (7.23) and it says the encoding is
ISO-8859-1 while it detects utf-8 for other websites (such as google).
Internet Explorer doesn't really tell me anthing.

Thanks in advance.



Relevant Pages

  • Re: Thai translation
    ... I use Internet ... Explorer and encoding is on UTF-8 here. ...
    (soc.culture.thai)
  • Re: unicode(s, enc).encode(enc) == s ?
    ... I will chunk my responses as your message has too much ... determine whether, for a given encoding, two byte strings would be ... Assuming Unicode's unification, for a single encoding, this should ...
    (comp.lang.python)
  • Re: [PATCH 1/2] Avoid bio_endio recursion
    ... The only material difference between SATA and SCSI is the encoding of the ... command blocks and responses. ...
    (Linux-Kernel)
  • Re: Tiny Personal Firewall - speed - Thanks
    ... ('binary' encoding is not supported, ... Your responses have been 100% consistent that my ... issue is not with Tiny Personal Firewall. ... Your responses are actually a relief for me; ...
    (Security-Basics)
  • Re: automating the SQL warning and the choice of text format
    ... automatically select 'yes' and 'utf-8' rather than changing the registry, ... In order to get the correct encoding, I believe that you have to do the ... You need one of those for each data source. ... For a comma-delimited file using UTF-8 encoding, ...
    (microsoft.public.word.mailmerge.fields)