Hi,

I'm having trouble getting html form parameters in my Internationalized
Servlet. I have a form in korean with a hidden field which contains
Korean text. However when I use the HttpServletRequest.getParameter() method
in my servlet to obtain the Korean text it is garbled. I am running
on a Korean version of Windows so the default encoding used by
the Virtual Machine is EUC_KR (i.e. file.encoding is EUC_KR).

I wrote some test code in my servlet and noticed something strange:

                String val = req.getParameter("ttile__text");
                String line = new String(val.getBytes("ISO8859_1"));

the variable val is garbled however the variable line is ok (I am dumping
these out to a file using a Writer).
Here is what I think is happening: The browser is correctly sending the
bytes to the servlet. However the getParameter method of the servlet
is creating a String using the bytes and using "ISO8859_1" as the encoding
(kind of like: new String(byteArray,"ISO8859_1")). This would explain
why things work when I get back the "orignal" (i.e. sent by the browser)
bytes using val.getBytes("ISO8859_1") and then create a new String
(which would use the default encoding of the Virtual Machine - i.e EUC_KR
- to correctly interpret the bytes).
 have tried this using JavaWebServer 1.1.3 as well as JavaWebServer2.0

Is there some setting that I need to change for the JavaWebServer so that
it uses EUC_KR when creating a String from the bytes received by the
browser? I tried setting the content-type in the form hoping that
perhaps getParameter() would use the encoding specified by content-type
to interpret the bytes but it didn't help.
I've tried countless things but no luck so far.

Any help would be greatly appreciated.

Much Thanks :-)
-Sher

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to