tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thomas <ma...@apache.org>
Subject Re: Is UTF-8 used everywhere for Tomcat 8.5.6?
Date Mon, 17 Oct 2016 20:00:15 GMT
On 17/10/2016 17:59, R wrote:
> Hi,
> 
> I have a default installation of Tomcat 8.5.6. When I make a POST request
> with a tilde character, and the encoding is set to UTF-8, it seems that my
> servlet handler is decoding it incorrectly.

The tilde character should not need to be encoded. The byte sequence is
also identical between UTF-8, ISO-8859-1 and ASCII.

You'll need to be more specific about exactly what URL you are passing
to Tomcat.


> I have to set the character
> encoding on the HttpServletRequest parameter to decode properly, example:
> 
>   protected void doPost(HttpServletRequest request, ...) {
>       // I have to set this manually.
>       request.setCharacterEncoding("UTF-8");
> 
>       // Decoding works now.
>       String test = request.getParam("test");
>       ...
>   }
> 
> Reading the Tomcat docs, it seems like everything should be UTF-8 by
> default. Is there a setting we still have to apply to get UTF-8 to be the
> default encoding?

No. Tomcat 8.5.x uses UTF-8 by default.

Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message