You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Turgay Zengin <tu...@hotmail.com> on 2001/05/16 13:53:18 UTC

National characters don't reach Action class correctly

Hi,
I need help on this:
Problem is, I can see national characters on jsp pages correctly, but when I 
post data to an Action, the string gets messed up. I couldn't find related 
info in the archive.

Related lines on my jsp page:

<%@ page contentType="text/html; charset=ISO-8859-9" %>
<html:html locale="true">
<FORM METHOD="POST" ACTION="UpdateWoplan.do">
<INPUT TYPE="text" NAME="fieldname" size="5"
     value="<bean:write name="wpl" property="laborhrs"/>">
</FORM>
(I had to use the FORM tag because I have indexed fieldnames)

And my Action class looks like:
public class UpdateWoplanAction extends Action {
   .......
   System.out.println(request.getParameter("fieldname");
}

I cannot get the correct string here. Instead I get ????s for national 
characters like ля­■.

I couldn't figure out where the problem is - in Struts or in Tomcat. But I 
did a test without using Struts, and the correct string is recognized by a 
servlet then.

Any help will be very much appreciated.

Thanks,
Turgay.
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


Re: National characters don't reach Action class correctly

Posted by Peiqiang Han <pe...@nextenso.com>.
Turgay,

If you use Tomcat 4.0 (servlet spec 2.3), you can just wirte:

request.setCharacterEncoding("ISO-8895-9");
System.out.println(request.getParameter("filename"));

If you use Tomcat 3.2 (Servlet spec 2.2),

String data = request.getParameter("filename");
byte[] raw = data.getBytes("ISO-8859-1");
System.out.println(new String(raw, "ISO-8859-9"));

hope this helps,
Peiqiang Han




Turgay Zengin wrote:

> Hi,
> I need help on this:
> Problem is, I can see national characters on jsp pages correctly, but when I
> post data to an Action, the string gets messed up. I couldn't find related
> info in the archive.
>
> Related lines on my jsp page:
>
> <%@ page contentType="text/html; charset=ISO-8859-9" %>
> <html:html locale="true">
> <FORM METHOD="POST" ACTION="UpdateWoplan.do">
> <INPUT TYPE="text" NAME="fieldname" size="5"
>      value="<bean:write name="wpl" property="laborhrs"/>">
> </FORM>
> (I had to use the FORM tag because I have indexed fieldnames)
>
> And my Action class looks like:
> public class UpdateWoplanAction extends Action {
>    .......
>    System.out.println(request.getParameter("fieldname");
> }
>
> I cannot get the correct string here. Instead I get ????s for national
> characters like ÐÞðþ.
>
> I couldn't figure out where the problem is - in Struts or in Tomcat. But I
> did a test without using Struts, and the correct string is recognized by a
> servlet then.
>
> Any help will be very much appreciated.
>
> Thanks,
> Turgay.
> _________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.