On 02/28/2004 11:37 PM Jon Bohm wrote:
Hello,

I'm using Aaron Rustads SetCharacterEncodingFilter-filter for Struts but with mixed results (see link below).

* All my Resource-, JSP- and Java-files are saved in UTF-8 format.

Hi Jon,
do you mean you have to use a UTF-8 editor to edit the files? This doesnt sound right. I have not done this yet for my app, but it's on the list to do: for your Resource files, for UTF-8, you should write them in UTF-8 and then convert them to ascii using native2ascii, a Java app that comes with the Java SDK.


I think your JSPs and Java files should be uncoded for the character set.

First problem: Posted data from a web form is sent as UTF-8, which is
 great - the filter works! But if I want to print the form bean
values in another JSP-page with the bean:write tag, the bean property
must return 'new String(oldString.getBytes(), "UTF-8")' for it to
work. Am I doing something wrong here?`

Probably related to the issue above. That conversion shouldn't be necessary when using the filter.



Second problem: Swedish letters Ä Ö and Å are not compatible with UTF-8? These characters A (with two dots), A (with a circle) and O (with two dots) never work, which is the opposite from their lowercase counterparts which works fine.

You don't mention what version of tomcat you are using. It is also affected by JSTL if you use that. A good debugging help is to put something like this at the end of your JSP:


out.print("<div>locale: " +
 session.getAttribute(org.apache.struts.Globals.LOCALE_KEY) +
 "</div>");
out.print("<div>request character encoding=" +
 request.getCharacterEncoding() + "</div>");
out.print("<div>response character encoding=" +
 response.getCharacterEncoding() + "</div>");


http://www.anassina.com/struts/i18n/i18n.html

Good link, but getting a little out-of-date now.



Adam -- struts 1.1 + tomcat 5.0.16 + java 1.4.2 Linux 2.4.20 Debian


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to