You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Christopher Cheng <ch...@chengsfamily.net> on 2002/02/12 02:46:49 UTC
internationalization
I am struggling with double byte characters with the JSP
On the struts jsp form, I am putting
<%@ page contentType="text/html; charset=UTF-8" %> on the top <META
http-equiv="Content-Type" content="text/html; charset=UTF-8"> in the
head
I got some question marks when I print the characters in the console by
System.out.println(request.getParameter("parameter1")
Or save those character to file
The same thing happens with the data retrieved from MySQL displayed on
JSP.
Anybody helps?
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: internationalization
Posted by Michael Baldwin <mi...@sun.com>.
You are on the right track.
1. Ensure that MySQL supports using a unicode character set. You may need to
define this at install time, that is how oracle works.
2. When request parameters come in, they are assumed to be ISO-8859 (or whatever
your platform default is) and encoded from there to unicode. You need to tell
the web container that the input stream coming in from clients is actually in
UTF-8, not ISO-8859.
If you are using a 2.3 servlet container this trick is much easier. There is a
struts parameter to the controller servlet will have some impact here, try
setting the content parameter to be "text/html;charset=UTF-8". If you are not
using a 2.3 servlet container (e.g., old tomcat) your work will be somewhat more
involved.
Also try reading http://tagunov.newmail.ru/i18n/i18n.html
good luck.
--Michael
Christopher Cheng wrote:
> I am struggling with double byte characters with the JSP
>
> On the struts jsp form, I am putting
>
> <%@ page contentType="text/html; charset=UTF-8" %> on the top <META
> http-equiv="Content-Type" content="text/html; charset=UTF-8"> in the
> head
>
> I got some question marks when I print the characters in the console by
> System.out.println(request.getParameter("parameter1")
> Or save those character to file
>
> The same thing happens with the data retrieved from MySQL displayed on
> JSP.
>
> Anybody helps?
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>