You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Lulseged Zerfu <zl...@hotmail.com> on 2014/09/03 13:45:15 UTC
UTF-8 encoded request URI
Hi I am getting bad request from tomcat when I send UTF-8 encoded request to my application. I have configured connector in my server.xml with URIEncoding=”UTF-8”. I have set charset in the request to UTF-8. How can I solve 400 Bad request? How can I tell tomcat to decode request URI instead of responding with 400 Bad request? I will appreciate any help.
I am using tomcat 8.0.11 on windows 8 x64. I have also tried with tomcat 7.0.55. BRLulseged
Re: UTF-8 encoded request URI
Posted by André Warnier <aw...@ice-sa.com>.
Lulseged Zerfu wrote:
> Hi I am getting bad request from tomcat when I send UTF-8 encoded request to my application. I have configured connector in my server.xml with URIEncoding=”UTF-8”. I have set charset in the request to UTF-8. How can I solve 400 Bad request? How can I tell tomcat to decode request URI instead of responding with 400 Bad request? I will appreciate any help.
> I am using tomcat 8.0.11 on windows 8 x64. I have also tried with tomcat 7.0.55. BRLulseged
Hi.
To post to this list, you should probably set your email program to send messages as
"plain text". That would make it easier to read them.
About your question :
If Tomcat responds that the request is invalid, then it probably is.
So the question is not how to make Tomcat consider it as valid, but rather how to generate
a valid request, from the client side.
You do not provide the real request that results in such a Tomcat response, so it is
difficult to tell.
If I had to guess, I would guess that it is the page in which there is the link that you
click, to generate this error in Tomcat, that is not correct.
Maybe the page says that it is UTF-8, but the link itself (in the "<a href=...> that you
click on) is in another encoding, or vice-versa ? It may also be wrongly URL-encoded.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: UTF-8 encoded request URI
Posted by "Igal @ getRailo.org" <ig...@getrailo.org>.
On 9/3/2014 4:52 AM, Mark Thomas wrote:
> On 03/09/2014 12:45, Lulseged Zerfu wrote:
>> Hi I am getting bad request from tomcat when I send UTF-8 encoded
>> request to my application. I have configured connector in my
>> server.xml with URIEncoding=”UTF-8”. I have set charset in the
>> request to UTF-8. How can I solve 400 Bad request?
> Don't send an invalid request.
Unfortunately this is not always within our control. I've been seeing
the following in my log files recently:
java.nio.charset.IllegalCharsetNameException:'UTF-8' caused by different
User Agents like "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1;
Trident/5.0)" and "Amazon CloudFront"
It happens when I try to get the request headers. I don't have a full
stacktrace or more details because I am not logging that ATM, but I can
add it to the logs if needed.
--
Igal Sapir
Railo Core Developer
http://getRailo.org/
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: UTF-8 encoded request URI
Posted by Mark Thomas <ma...@apache.org>.
On 03/09/2014 12:45, Lulseged Zerfu wrote:
> Hi I am getting bad request from tomcat when I send UTF-8 encoded
> request to my application. I have configured connector in my
> server.xml with URIEncoding=”UTF-8”. I have set charset in the
> request to UTF-8. How can I solve 400 Bad request?
Don't send an invalid request.
> How can I tell tomcat to decode request URI instead of responding with 400 Bad
> request?
You can't. Tomcat will always reject invalid requests with a 400 response.
> I will appreciate any help. I am using tomcat 8.0.11 on
> windows 8 x64. I have also tried with tomcat 7.0.55. BRLulseged
Again, read this:
http://www.catb.org/esr/faqs/smart-questions.html
Then try asking your question again and provide enough information that
someone on this list stands some chance of being able to figure out what
the error is.
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: UTF-8 encoded request URI
Posted by Daniel Mikusa <dm...@pivotal.io>.
On Wed, Sep 3, 2014 at 7:45 AM, Lulseged Zerfu <zl...@hotmail.com>
wrote:
> Hi I am getting bad request from tomcat when I send UTF-8 encoded request
> to my application.
Can you give an example of the request? Are the non-ascii characters in
the URL or in the payload of your request (or both)?
> I have configured connector in my server.xml with URIEncoding=”UTF-8”.
Not necessary with Tomcat 8. The default for URIEncoding is "UTF-8".
Unless you have set the system
property org.apache.catalina.STRICT_SERVLET_COMPLIANCE=true. That will
override the URIEncoding and set it to "ISO-8859-1".
I have set charset in the request to UTF-8. How can I solve 400 Bad
> request? How can I tell tomcat to decode request URI instead of responding
> with 400 Bad request?
You seem certain that the 400 error is due to the encoding. Perhaps it's
something else? What have you done to troubleshoot this? Have you tried
stepping through things with a debugger?
Dan
> I will appreciate any help.
> I am using tomcat 8.0.11 on windows 8 x64. I have also tried with tomcat
> 7.0.55. BRLulseged