struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "red phoenix" <rodphoe...@gmail.com>
Subject Re: Struts2 character code question
Date Wed, 09 May 2007 01:31:20 GMT
I have set URIEncoding="UTF-8"
and when I submit as
 <s:form method="post" action=" test.do?Name=Chinese code">

and I get String name=request.getParameter("Name")
it get name as UTF-8 format,so I can't get right chinese code

I tried set <Connector port="8080" protocol="HTTP/1.1"
               maxThreads="150" connectionTimeout="20000"
               redirectPort="8443" URIEncoding="GB2312"/>

This time,I can get right chinese code in test.do by
String name=request.getParameter("Name")

But i only want to set <Connector port="8080" protocol="HTTP/1.1"
               maxThreads="150" connectionTimeout="20000"
               redirectPort="8443" URIEncoding="UTF-8"/>

Anybody could tell me how to do in test.do file?



On 5/9/07, Martin Gainty <mgainty@hotmail.com> wrote:
>
> apparently ISO2022_CN_GB is Mandarin
> (http://java.sun.com/j2se/1.4.2/docs/guide/intl/encoding.doc.html)
> since this is most decidedly DBCS did you load CJK IME /Keyboard and
> Fonts?
>
> M--
> This email message and any files transmitted with it contain confidential
> information intended only for the person(s) to whom this email message is
> addressed.  If you have received this email message in error, please
> notify
> the sender immediately by telephone or email and destroy the original
> message without making a copy.  Thank you.
>
> ----- Original Message -----
> From: "red phoenix" <rodphoenix@gmail.com>
> To: "Struts Users Mailing List" <user@struts.apache.org>
> Sent: Tuesday, May 08, 2007 8:47 PM
> Subject: Re: Struts2 character code question
>
>
> >I tried follows in test.do:
> > String name=request.getParameter("Name");
> > System.out.println(new String(name.getBytes("UTF-8"), "gb2312"))
> > it still show ???[B@15b1773,Why?
> >
> >
> >
> > On 5/8/07, Christopher Schultz <chris@christopherschultz.net> wrote:
> >>
> >> -----BEGIN PGP SIGNED MESSAGE-----
> >> Hash: SHA1
> >>
> >> Red,
> >>
> >> red phoenix wrote:
> >> > If I input English name in the field Name in JSP,when I submit,the
> >> > test.do will receive right English name,but when I input Chinese name
> >> > in the field Name in JSP, test.do will receive not right name,it will
> >> > show ???[B@15b1773
> >>
> >> This is what you get when you print out a byte array. Try converting
> the
> >> byte array to a String using "new String(bytes, charset)" and printing
> >> that.
> >>
> >> - -chris
> >> -----BEGIN PGP SIGNATURE-----
> >> Version: GnuPG v1.4.7 (MingW32)
> >> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> >>
> >> iD8DBQFGQJwZ9CaO5/Lv0PARAmyvAJ9aCJZ/MINdBzS18ytQMgzf4M8D3ACffHSG
> >> Ldprq3v5ZTLxYF80HoafTOY=
> >> =vx7I
> >> -----END PGP SIGNATURE-----
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: user-help@struts.apache.org
> >>
> >>
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message