Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > JBoss, Struts and UTF-8

Reply
Thread Tools

JBoss, Struts and UTF-8

 
 
Electric Natcho
Guest
Posts: n/a
 
      11-29-2003
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.RequestPr ocessor" />
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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Eclipse and Ant with Struts: how to combine to generate javadoc api, how to map struts source to binary code for debugging Merlijn Java 0 03-24-2006 01:47 PM
Is it safe to point to Internet for locating struts DTD files in struts TLDs and XML files? Katie Wright Java 8 01-07-2005 03:37 PM
[Struts]output javascript in struts perform() sin Java 3 02-22-2004 08:27 AM
Integrate a Struts app with a non-struts app jc1771 Java 0 12-28-2003 06:36 PM
Struts Installation - missing struts.tld??? Jason Us Java 0 10-03-2003 11:36 PM



Advertisments