I was afraid of that.  I've already coded that into a workaround.  Was just
hoping there was a cleaner way of doing.
Oh well.  Thanks.

Joseph Karau
Kingland Systems
[EMAIL PROTECTED]
507-536-3629
AIM: jkara3629


-----Original Message-----
From: Hans Bergsten [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 28, 2002 1:08 PM
To: [EMAIL PROTECTED]
Subject: Re: HttpServletRequest characterEncoding


Karau, Joe wrote:

> Hi,
>         I'm working on internationalizing our site.  So far, every thing
is
> coming from the server in UTF-8 fine.  However, when a user sends a
request
> to our server, the HttpServletRequest.getCharaceterEncoding method is
> returning the encoding of "iso-8859-1".


Yes, this is a problem caused by browsers not complying with the
HTTP spec. Most of them don't send a Content-Type request header
with the charset used for encoding the parameters.

> I've found that in the newer
> Servlet spec, I still have to use 2.2, there is a method for setting the
> character encoding on the request object, but I have not found any way of
> doing it in 2.2.
>
>         Any help, tips, or ideas would be greatly appreciated.  Thanks.


In 2.2 you have to do the conversion yourself, like this:

   String requestCharset = "UTF-8";
   String encodedValue = request.getParameter("myParam");
   String decodedValue =
     new String(encodedValue.getBytes("8859_1"), requestCharset);

Hans
--
Hans Bergsten           [EMAIL PROTECTED]
Gefion Software         http://www.gefionsoftware.com
JavaServer Pages        http://TheJSPBook.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to