Boy, Howdie, Hiran! It would be great to have RequestUtils be
extensible. That sounds like the start of something really good to me.
Michael McGrady
[EMAIL PROTECTED] wrote:
Hi, Craig.
You hit the bull's eye. No I claim this not only to be a JSP/Servlet problem.
The way you describe will cause the browser to encode all form data with UTF-8.
Unfortunately the servlet container (Tomcat in my case) does not know about this.
To obtain the correct parameter values, someone has to call (beware of Nullpointers
and UnsupportedEncodingExceptions)
new String(request.getParameter("...").getBytes("ISO-8859-1"), "UTF-8")
This conversion must be applied to all parameter values. Either it is done once in
Struts, or each and every Action has to convert the values Struts provides, breaking
this really nice architecture of FormBeans. In Cocoon I see this type of conversion
can be turned on and off by configuration.
I recommend changing the RequestUtils' populate method (which I did for me), or
enhancing the RequestProcessor to allow RequestUtils to be replaced by subclasses
thereof so people like me can plug in their own RequestUtils. What do you think?
Hiran
-----------------------------------------
Hiran Chaudhuri
SAG Systemhaus GmbH
Elsenheimer Straße 11
80867 München
Phone +49-89-54 74 21 34
Fax +49-89-54 74 21 99
-----Original Message-----
From: Craig McClanahan [mailto:[EMAIL PROTECTED]
Sent: Dienstag, 5. Oktober 2004 23:47
To: Struts Users Mailing List
Subject: Re: Internationalizing a Struts project
On Tue, 5 Oct 2004 16:31:14 +0200,
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Hi there.
I'm working on i18n of a Struts based project. All
references I find about this topic deal with using messages
depending on the user's locale. Has anyone ever experienced
problems with national special characters (such as currency
symbols for sterling or euro?
Hiran
This issue is more related to the way JSP works than Struts,
but here's a summary.
The most important consideration for national characters is
the character encoding that will be used to send the response
back to the browser. Unless you ask for something different
explicitly, JSP pages are always sent back in ISO-8859-1
(basically 7-bit ASCII), which will create problems with
characters outside the 7-bit range.
To ask for the content encoding to be set differently, you
use the page directive at the top of your JSP pages, for
example, to select
UTF-8:
<%@ page contentType="text/html;charset=UTF-8" %>
If all of your national characters are produced by custom
tags (such as <bean:write> or <html:input> in the case of
Struts), this should be all you need. If you also want to
use literal characters in the template text of your JSP page,
you have to go one step further -- actually store the source
code of your JSP page in an appropriate encoding, and tell
the JSP compiler what that encoding is. The details of how
you save pages in a particular encoding will depend on the
text editor or IDE you are using, but the mechanism to tell
JSP about it is standard. So, if you also use UTF-8 encoding
for your source page, you'd say:
<%@ page pageEncoding="UTF-8"
contentType="text/html;charset=UTF-8" T%>
Craig McClanahan
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]