JBoss, Struts and UTF-8

E

Electric Natcho

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,736
Latest member
zacharyharris

Latest Threads

Top