You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Nayyer Kamran <Na...@orbian.com> on 2008/08/15 13:48:27 UTC
URIEncoding UTF-16 problem
Hello,
I am facing problem in accessing deployed modules once I configured connector's URIEncoding to "UTF-16" in server.xml. The log is showing nothing unusual but no web module is accessible and throwing http status 404.
Can you some one told me what is the reason? Do I need to modify some other configurations as well?
Environment information
Windows XP Professional
Tomcat 5.0.24
Modified Configuration.
<Connector port="8080"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
debug="0" connectionTimeout="20000"
disableUploadTimeout="true"
URIEncoding="UTF-16"/>
Regards,
*******************************************************************************
This email and any files transmitted with it are intended solely for the use of the individual or entity to whom they are addressed, and may contain confidential and/or proprietary information. Therefore, any dissemination, distribution or copy of this email or such attached files, or the information contained herein and therein, should be appropriately restricted.
If you have received this email in error please notify the sender immediately by return email and kindly delete this message and all attachments..
*******************************************************************************
Re: URIEncoding UTF-16 problem
Posted by André Warnier <aw...@ice-sa.com>.
Replying to myself :
André Warnier wrote:
My own name, expressed in the
> Unicode alphabet and encoded in UTF-8, occupies 6 bytes, not 7.
I meant "6 bytes, not 5", of course.
It rather weakens my argument when I mix-up my own byte counts...
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: URIEncoding UTF-16 problem
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
André,
André Warnier wrote:
>
> The OP is talking about UTF-16, not UTF-8.
I understand. I was trying to contrast UTF-8 and UTF-16, apparently
unsuccessfully.
> What you are saying above about ASCII/UTF-8 is true, if one restricts
> oneself to strictly the 7-bit US-ASCII.
ASCII is not US-specific, and everything above 127 has pretty much
always been non-standard. So, yes, I was talking about 7-bit ASCII.
> That'ok for English, but not OK
> for mostly any other language on this planet.
It handles English, German, and Latin languages. It does not handle many
others. Again, I was trying to point out that if you set your server to
UTF-8 and the client is expecting ASCII, then there is no problem (and I
believe this is a common case). Most clients these days use UTF-8 by
default, so you're safe that way, too.
Nobody really uses UTF-16 on clients by default so by setting your URI
encoding to UTF-16 basically means that nobody will ever be able to
successfully contact your server unless they know beforehand that UTF-16
should be used.
> The default charset on the Web is iso-8859-1 (latin-1), not US-ASCII.
The first 127 characters of (US-)ASCII, UTF-8, and ISO-8859-1 are
identical. Again, you're covered.
> Now about the "first request" bit : not on the first request, nor on any
> subsequent request, unless the server finds a way to tell the
> application that it only accepts requests with URI's encoded as UTF-16,
> and the browser not only understands the instruction, but obeys it.
Most clients will use the content encoding of the previous response for
the URI of the next request. At least, that has been my experience.
> So, back to the original question : why set the connector to UTF-16 URI
> encoding ? That will almost guarantee that Tomcat will not properly
> understand any URL requested by a standard browser.
Exactly my point: why use UTF-16 when you can use UTF-8, get all the
benefits of oodles of characters, /and/ conform to the expectations of
nearly every client out on the Internet?
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkiphkYACgkQ9CaO5/Lv0PB5SgCbBYRUSIETPriBdLCn4KM/i7Jg
VEMAnjvVm8nc7G8TEeXxRlDMfsuwGbyA
=qu8D
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: URIEncoding UTF-16 problem
Posted by André Warnier <aw...@ice-sa.com>.
Christopher Schultz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> André,
>
> André Warnier wrote:
>> Could you tell us *why* exactly you [are trying to use UTF-16]?
>> It is rather unusual, as it supposes that you expect all clients to
>> encode their requested URI's in UTF-16 prior to sending the request to
>> Tomcat on that connector. To my knowledge, no standard client (browser)
>> will ever do so.
>
> ...at least not on the first request.
>
> The beauty of using an encoding like UTF-8 is that ASCII is a strict
> subset: any plain-old ASCII request can be interpreted as a UTF-8
> request, which means that if you want to use UTF-8 on your site, but
> your visitors come in using ASCII, there's no problem (unless they have
> weird characters in their first request, which is rare).
The OP is talking about UTF-16, not UTF-8.
What you are saing above about ASCII/UTF-8 is true, if one restricts
oneself to strictly the 7-bit US-ASCII. That'ok for English, but not OK
for mostly any other language on this planet.
The default charset on the Web is iso-8859-1 (latin-1), not US-ASCII.
Any character of iso-8859-1 whose codepoint is above 128 decimal does
not encode as a single byte in UTF-8. My own name, expressed in the
Unicode alphabet and encoded in UTF-8, occupies 6 bytes, not 7.
Encoded as UTF-16, it occupies 12 bytes, half of which have a hex value
of 00.
Now about the "first request" bit : not on the first request, nor on any
subsequent request, unless the server finds a way to tell the
application that it only accepts requests with URI's encoded as UTF-16,
and the browser not only understands the instruction, but obeys it.
If there is an accepted and supported way to do that, I'd be glad to
hear it, as it would solve a lot of practical web
internationali(z/s)ation problems.
So, back to the original question : why set the connector to UTF-16 URI
encoding ? That will almost guarantee that Tomcat will not properly
understand any URL requested by a standard browser.
André
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: URIEncoding UTF-16 problem
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
André,
André Warnier wrote:
> Could you tell us *why* exactly you [are trying to use UTF-16]?
> It is rather unusual, as it supposes that you expect all clients to
> encode their requested URI's in UTF-16 prior to sending the request to
> Tomcat on that connector. To my knowledge, no standard client (browser)
> will ever do so.
...at least not on the first request.
The beauty of using an encoding like UTF-8 is that ASCII is a strict
subset: any plain-old ASCII request can be interpreted as a UTF-8
request, which means that if you want to use UTF-8 on your site, but
your visitors come in using ASCII, there's no problem (unless they have
weird characters in their first request, which is rare).
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkilnPIACgkQ9CaO5/Lv0PCGAACfbQ104lWe+PbiZG1/O8yVYtu2
RXAAnAq8j9ta6m80E5zmRN2WLuFukxaj
=f/2i
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: URIEncoding UTF-16 problem
Posted by André Warnier <aw...@ice-sa.com>.
Nayyer Kamran wrote:
> Hello,
>
>
>
> I am facing problem in accessing deployed modules once I configured connector's URIEncoding to "UTF-16" in server.xml.
Hi.
Could you tell us *why* exactly you did set this attribute ?
It is rather unusual, as it supposes that you expect all clients to
encode their requested URI's in UTF-16 prior to sending the request to
Tomcat on that connector. To my knowledge, no standard client (browser)
will ever do so.
Also, do you really known what it means ?
UTF-16 is a Unicode encoding where each character occupies 2 bytes (16
bits). For most of the Western and Eastern European alphabetic
characters, this results in a byte 0 followed by a non-zero byte.
That probably explains why Tomcat is not recognising any of the URLs
that you try to access, and giving 404 errors all the time. It's just
that the URI as Tomcat sees it, never matches any of your webapps.
Setting the URI encoding differently from the default normally supposes
that the two sides (client and server) agree on an alternative encoding
for the URI's. You cannot just do it on one side and not on the other.
André
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org