Adam Hardy wrote:
Hi Joerg,
since you are using struts, why don't you ditch the SetCharacterEncodingFilter and set the character-encoding as a property of the struts controller? This means you also don't need anything in your JSPs.

Ah, okay. It's our first Struts project and experience. I found http://jakarta.apache.org/struts/api/org/apache/struts/config/ControllerConfig.html#contentType and set the contentType in the struts-config.xml with
<controller contentType="text/html;charset=UTF-8"/>. But as written at the above link this option sets only "the content type and character encoding ... on each response". This means it does not handle/influence the request character encoding.


I assume you are using form-based container-managed authentication as the interface to the JAAS realm. If so, I do not understand how you have a character encoding problem with the login form, since you can just set the character encoding in the JSP as a scriptlet or in HTML as a meta tag.

Yes, it's a simple HTML form, the page is in UTF-8 (Mozilla > View Page Info), so that's ok. But again this is only server response. The next request is then sent in UTF-8, but the server does not know how to handle it, the character encoding is null. It assumes default encoding which should be ISO-8859-1. Setting the character encoding to UTF-8 makes the server understanding the request.


I stand a few days away from setting up the same configuration myself, albeit without JBoss, so I would be interested in your reply.

albeit - does not sound very English, but my dictionary knows it :-)


Joerg

On 09/23/2003 11:01 AM Joerg Heinicke wrote:

Hello,

we have a Struts web application, that should use UTF-8 as character encoding. I set the content type for the HTML pages (JSP) as well as the character encoding on the request via the SetCharacterEncodingFilter delivered with Tomcat in the examples webapp. It works in the whole application.

But: It's Tomcat 4.1.18 integrated in JBoss 3.0.6 and we do authentication using JAAS and I found no possibility to set the request encoding of the JAAS request (to j_security_check). This resulted in "wrong username or password" for "müller", which could be fixed in the login module by recoding the string. But we also have a "logged in as" on every page and there was not written "müller", but the infamous UTF-8 vs. ISO-8859 "mA¼ller", because it was wrongly set on the request object or at least wrongly read from there.

I have fixed it by writing a SetCharacterEncodingValve and now also the JAAS request is handled as UTF-8, but the application depends on Tomcat now. Does anybody know how to configure the filter mapping to match also the JAAS request? As far as I know the JAAS request is "catched" by the servlet container and does not arrive at the web app. This means the filter mapping in the web.xml can't be read/used.

I would like to replace the Valve with the Filter to avoid servlet container dependency. I appreciate any help.

Regards,

Joerg

-- System Development VIRBUS AG Fon +49(0)341-979-7419 Fax +49(0)341-979-7409 [EMAIL PROTECTED] www.virbus.de


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



Reply via email to