You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Justin Dang <jd...@gmail.com> on 2017/01/25 05:25:45 UTC

Character encoding issue in URL

Hi, I have a clean install of an older version of Tomcat (8.0.24).  I have
noticed when a character is encoded in the URL, Tomcat fails to return the
URL requested.  I've noted this same request performed in IIS works fine.

Apache Tomcat tests:

Works (No escape) –  http://localhost:8080/examples/delme/íj.pdf

Works (URL encoded) –  http://localhost:8080/examples/delme/%C3%ADj.pdf

Failed (Char encoded) – http://localhost:8080/examples/delme/%EDj.pdf



IIS tests:

Works (No escape)  –  http://localhost:8080/examples/delme/íj.pdf

Works (URL encoded) –  http://localhost:8080/examples/delme/%C3%ADj.pdf

Works (Char encoded) – http://localhost:8080/examples/delme/%EDj.pdf


I've reviewed this wiki page:


https://wiki.apache.org/tomcat/FAQ/CharacterEncoding


And it seems to imply that I shouldn't have to do anything, and the URL
request should return properly.


So my question is, what do I need to configure in Apache Tomcat to handle
the character encoding request like IIS does?

Re: Character encoding issue in URL

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Justin,

On 1/25/17 12:25 AM, Justin Dang wrote:
> Hi, I have a clean install of an older version of Tomcat (8.0.24).
> I have noticed when a character is encoded in the URL, Tomcat fails
> to return the URL requested.  I've noted this same request
> performed in IIS works fine.
> 
> Apache Tomcat tests:
> 
> Works (No escape) \u2013  http://localhost:8080/examples/delme/�j.pdf
> 
> Works (URL encoded) \u2013
> http://localhost:8080/examples/delme/%C3%ADj.pdf
> 
> Failed (Char encoded) \u2013
> http://localhost:8080/examples/delme/%EDj.pdf

You are mistaken. While you might think that %ED would map to U+00ED,
it does not. You need to use %C3%AD as you have done in your second
example, because the standard is UTF-8 and not UTF-16 or anything like
that.

%ED is not a valid character in UTF-8.

https://en.wikipedia.org/wiki/UTF-8#Description

> IIS tests:
> 
> Works (No escape)  \u2013  http://localhost:8080/examples/delme/�j.pdf
> 
> Works (URL encoded) \u2013
> http://localhost:8080/examples/delme/%C3%ADj.pdf
> 
> Works (Char encoded) \u2013
> http://localhost:8080/examples/delme/%EDj.pdf
> 
> 
> I've reviewed this wiki page:
> 
> 
> https://wiki.apache.org/tomcat/FAQ/CharacterEncoding
> 
> 
> And it seems to imply that I shouldn't have to do anything, and the
> URL request should return properly.
> 
> 
> So my question is, what do I need to configure in Apache Tomcat to
> handle the character encoding request like IIS does?

Only by violating UTF-8.

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJYiNiJAAoJEBzwKT+lPKRY0I4P/2B84M/wkoomYdL3T2mgG7Pg
MjijT7cRrAnX/OhJsT1vILKFVeW8nB6O6IV2NDUx4CtqcVg/ce4cYPmoy0qADMyu
qHmwybGMauoIM6uamA1jxDiNWGElW36Wa6y8ESySFG0qzsK8o++XJMCINlS2hQJ9
g7dBcfVLXQc9PTYIGbrAQQ/oSVViRRgfsW5TgH0YlVfie1iSASRm9lcYLHliDGH9
S3NMPdmaRE+lwkrKJ1X6r+Kxz95e5hxQWQPXc4xGGcmZEC8PWcnQRiCob/TCqJUh
obKNrLEC/GvJ8gu7eCEFMDd6usjUIxJVjhGJDPo0vxVcLIJ9dte2kq714u12w7kl
49AMoyz+3Co5W5PheeqQnIoJhA5sqJRP3KxuxcfTJE7TyKn+SE2moC0twDKpur5W
exu5ps2wdaBmIBE3S5aXxGYpFmlm5dvdcM1lQjoiIdg5JdKZLacxP7DBCaVT8UC9
4/Siu1iDBz0KnEwCoBhFjlr8qVoSgCfRV6VEHjhr9z+yEG60cnniVk2diYdpcpia
W/iPEe7nFhzBjNelqh1IL9XlogTc4IIoL0T88ti5EYks/pKgr4Ilsh08IkJhtHk6
vH3jCmdbR3c3Gb002lOMk9oBYyvOSxnwUr34n7KXcEYitJd8a8YNm+tNsKQ14ZLS
1z8g/1zJZSrGZdX6n8g9
=4ASz
-----END PGP SIGNATURE-----

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