You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Zsolt Koppany <zk...@intland.com> on 2003/11/03 21:43:56 UTC

Working with UTF-8 and problems with German Umlauts

Hi,

I have problems with German Umlauts when I enter the code below to my jsp
pages. The problem is when I for example I forget to fill a required field
and the previous values are restored after validation.

How can I fix that?

I use tomcat-4.1.24 with struts-1.1.


<%@ page contentType="text/html; charset=UTF-8" %>

<%request.setCharacterEncoding("UTF8");%>


Zsolt



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: Working with UTF-8 and problems with German Umlauts

Posted by Zsolt Koppany <zk...@intland.com>.
My problem was really, that my code was too late. After using a servlet
filter and calling request.setCharacterEncoding("UTF8") from the filter, my
problem was fixed.

Thank you everybody for the help.

Zsolt

> -----Original Message-----
> From: Jim Theodoridis [mailto:struts@tera.gr]
> Sent: Tuesday, November 04, 2003 5:18 PM
> To: Struts Users Mailing List
> Subject: Re: Working with UTF-8 and problems with German Umlauts
>
>
> I had the same problem in Greeks
> The first steep is to follow the instructions below
>
> http://www.anassina.com/struts/i18n
>
> ( If the page dos not displays tell me to send u via email )
>
> The second step, if u use a database, to retrieve data to work on UTF-8
> so database driver must support it.
>
> for mySQL below 4.x use
>
> String dbURL =
> "jdbc:mysql://localhost/YellowPages?useUnicode=true&characterEncod
> ing=UTF-8"
> ;
>
> i hope to help u
>
> ----- Original Message -----
> From: "Adam Hardy" <ah...@cyberspaceroad.com>
> To: "Struts Users Mailing List" <st...@jakarta.apache.org>
> Sent: Tuesday, November 04, 2003 12:31 AM
> Subject: Re: Working with UTF-8 and problems with German Umlauts
>
>
> > On 11/03/2003 09:43 PM Zsolt Koppany wrote:
> > > I have problems with German Umlauts when I enter the code below to my
> jsp
> > > pages. The problem is when I for example I forget to fill a required
> field
> > > and the previous values are restored after validation.
> > >
> > > How can I fix that?
> > >
> > > I use tomcat-4.1.24 with struts-1.1.
> > >
> > >
> > > <%@ page contentType="text/html; charset=UTF-8" %>
> > >
> > > <%request.setCharacterEncoding("UTF8");%>
> >
> > Hi Zsolt,
> > you are setting your character encoding way too late in the game. By the
> > point you set it in the JSP as you show above, Struts has already read
> > the request parameters into your form.
> >
> > A common method of setting the character encoding for struts is using a
> > filter, so the request is character-encoded before struts gets
> to see it.
> >
> > Adam
> >
> >
> > --
> > struts 1.1 + tomcat 5.0.12 + java 1.4.2
> > Linux 2.4.20 RH9
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Working with UTF-8 and problems with German Umlauts

Posted by Jim Theodoridis <st...@tera.gr>.
I had the same problem in Greeks
The first steep is to follow the instructions below

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

( If the page dos not displays tell me to send u via email )

The second step, if u use a database, to retrieve data to work on UTF-8
so database driver must support it.

for mySQL below 4.x use

String dbURL =
"jdbc:mysql://localhost/YellowPages?useUnicode=true&characterEncoding=UTF-8"
;

i hope to help u

----- Original Message -----
From: "Adam Hardy" <ah...@cyberspaceroad.com>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Tuesday, November 04, 2003 12:31 AM
Subject: Re: Working with UTF-8 and problems with German Umlauts


> On 11/03/2003 09:43 PM Zsolt Koppany wrote:
> > I have problems with German Umlauts when I enter the code below to my
jsp
> > pages. The problem is when I for example I forget to fill a required
field
> > and the previous values are restored after validation.
> >
> > How can I fix that?
> >
> > I use tomcat-4.1.24 with struts-1.1.
> >
> >
> > <%@ page contentType="text/html; charset=UTF-8" %>
> >
> > <%request.setCharacterEncoding("UTF8");%>
>
> Hi Zsolt,
> you are setting your character encoding way too late in the game. By the
> point you set it in the JSP as you show above, Struts has already read
> the request parameters into your form.
>
> A common method of setting the character encoding for struts is using a
> filter, so the request is character-encoded before struts gets to see it.
>
> Adam
>
>
> --
> struts 1.1 + tomcat 5.0.12 + java 1.4.2
> Linux 2.4.20 RH9
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Working with UTF-8 and problems with German Umlauts

Posted by Adam Hardy <ah...@cyberspaceroad.com>.
On 11/03/2003 09:43 PM Zsolt Koppany wrote:
> I have problems with German Umlauts when I enter the code below to my jsp
> pages. The problem is when I for example I forget to fill a required field
> and the previous values are restored after validation.
> 
> How can I fix that?
> 
> I use tomcat-4.1.24 with struts-1.1.
> 
> 
> <%@ page contentType="text/html; charset=UTF-8" %>
> 
> <%request.setCharacterEncoding("UTF8");%>

Hi Zsolt,
you are setting your character encoding way too late in the game. By the 
point you set it in the JSP as you show above, Struts has already read 
the request parameters into your form.

A common method of setting the character encoding for struts is using a 
filter, so the request is character-encoded before struts gets to see it.

Adam


-- 
struts 1.1 + tomcat 5.0.12 + java 1.4.2
Linux 2.4.20 RH9

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org