LP wrote:
>
> Is there a way for a servlet to get a proper String out of form's
> textbox when the client machine uses a charset other than ISO-8859-1?
Yes. You have to convert it back to bytes and then to String
again with proper encoding:
String foo =
new String(req.getParameter("foo").getBytes("ISO-8859-1"),"your_encoding");
>
> More specifically:
> - can I identify the client machine's charset?
No. HTTP don't specify charset of incoming requests. But the
charset is the same as in the page with the form, so you
have to know it. See http://www.w3.org/International/
> - can I get the URLencoded value of a form's field before it is
> decoded by the servlet or the server and decode it myself?
Yes. If it is send by POST method use request.getInputStream()
and read it binary.
Martin
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
INET, a.s. Mgr. Martin Kuba
Kralovopolska 139 e-mail: [EMAIL PROTECTED]
601 12 Brno WWW: http://www.inet.cz/~makub/
Czech Republic tel: +420-5-41242414/33
--------------------------------------------------------------------
PGP fingerprint = D8 57 47 E5 36 D2 C1 A1 C3 48 B2 59 00 58 42 27
http://wwwkeys.cz.pgp.net:11371/pks/lookup?op=index&search=makub
--------------------------------------------------------------------
___________________________________________________________________________
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