Re: getCharacterEncoding problem

On Thu, 20 Aug 1998, Skorupa, Grzegorz wrote:

> Hello!
> 
> I've created a servlet with doPost method:
> 
>   public void doPost(HttpServletRequest req, HttpServletResponse res)
> 	  throws ServletException, IOException
>   {
> 
>     System.out.println(req.getCharacterEncoding());
>     ...
>   }
> 
> I invoke this servlet from html page (including a form with POST action)
> with
> 
> <meta http-equiv="Content-Type"
> content="text/html; charset=iso-8859-2">
> 
> in it's header.
> 
> And getCharacterEncoding() always returns "ISO-8859-1".
> 
> I don't know what's going. Please help!

Well, there is no http headers containing the right character encoding.
Your trick to set the character encoding rely on the fact that a specific
browser will parse the HTML and use it as a fake HTTP header. 
For your servlet, the character encoding field has to be present as a real
http header.
Regards,
k

      /\          - Yves Lafon - World Wide Web Consortium - 
  /\ /  \        Architecture Domain - Jigsaw Activity Leader
 /  \    \/\    
/    \   /  \   http://www.w3.org/People/Lafon - ylafon@w3.org    

Received on Friday, 21 August 1998 05:33:05 UTC