Hi Greg, 

Thank you for your fast response.

I do write a filter to set the encoding to GB2312, but if I set the encoding to gb2312 
on every page, because this disallow my pages to accept other language charactors, 
right? Can I set the encoding dynamicly according to user's locale?

This is my filter in my web.xml

<filter>
<filter-name>Set Character Encoding</filter-name>
<filter-class>SetCharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>GB2312</param-value>
</init-param>
<init-param>
<param-name>ignore</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>Set Character Encoding</filter-name>
<servlet-name>action</servlet-name>
</filter-mapping>

Thanks again.

--bruce

----- Original Message ----- 
From: "Greg Reddin" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Friday, October 17, 2003 2:48 AM
Subject: Re: i18n - Chinese charactor problem


> I don't remember the exact code, but a looong time ago we had to write a 
> Filter that created a request wrapper that properly set the character 
> encoding on request parameters.  Maybe googling that would turn up 
> something.
> 
> Greg
> 
> ZYD wrote:
> > Hi, 
> > 
> > I have a problem in getting the Chinese charactors from <html:text>, 
> > 
> > The following is my jsp file: 
> > 
> > <%@ page contentType="text/html;charset=UTF-8" language="java" %>
> > <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
> > 
> > <html:html>
> > <html:form action="/submit" focus="email">
> >  <head></head>
> >  <body>
> >   <html:text property="email"/>
> > 
> >   <html:submit><bean:message key="button.logon"/></html:submit>
> >  </body>
> > </html:form>
> > </html:html>
> > ---------------------------------------------
> > I have two property files, one is for englisn, the other is for chinese. 
> > Both english and chinese can be displayed properly on the page, except in the text 
> > box.
> > 
> > When I input chinese charactors in the text box and submit, I cannot get the 
> > chinese charactor in the form bean correctly. The chinese charactors become some 
> > unreadable charactors like ????.
> > 
> > There are no special process in the getEmail and setEmail method in the form bean.
> > 
> > Does anybody have similar problem? I need your advice.
> > Any response is appreciated.
> > 
> > --bruce
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

Reply via email to