tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aleksandar Matijaca" <amatij...@gmail.com>
Subject FOLLOW-UP: Re: Tomcat 6 UTF-8 GET and POST - please Help..
Date Thu, 10 Jan 2008 19:08:08 GMT
I have tested the stuff below on JETTY, and both GET and POST work fine.

Thanks again, a.m.


On Jan 10, 2008 2:06 PM, Aleksandar Matijaca <amatijaca@gmail.com> wrote:

> Hi there,
>
> I am having some issue with submitting foreign language fonts in HTML form
> to Tomcat.
> If I set up the FORM with method="GET" everything works just fine.
> However, when I use
> POST, things don't work -  I get garbled characters in my servlet from the
> FORM.
> In the example below, I am showing the headers for both
> GET and POST - the character being sent is a single lower case letter "f"
> in cyrillic.
>
>
> ************************************************
>
> The POST method does not work - gives garbled characters - please note
> that
> the mytext is PROPERLY ENCODED IN BOTH methods - GET and POST,
> so I don't think that it is a browser issue (i think that my HTML is ok
> too).
>
>
> http://localhost:8080/Inter/takeText.do
>
> POST /Inter/takeText.do HTTP/1.1
> Host: localhost:8080
> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11)
> Gecko/20071127 Firefox/2.0.0.11
> Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9
> ,text/plain;q=0.8,image/png,*/*;q=0.5
> Accept-Language: en-us,en;q= 0.8,sr;q=0.5,hi;q=0.3
> Accept-Encoding: gzip,deflate
> Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
> Keep-Alive: 300
> Connection: keep-alive
> Referer: http://localhost:8080/Inter/takeText.do
> Cookie: JSESSIONID=yhhvgybm2jfa; sensitivity=1000.0;
> JSESSIONID=AF8D24C63CE9C16D5DF78E5CDDE26146
> Content-Type: application/x-www-form-urlencoded
> Content-Length: 13
> mytext=%D1%84
>
>
> ********************************************************************
>
> This is the request using GET - this works just fine - the servlet gets
> mytext nicely decoded...
>
>
> http://localhost:8080/Inter/takeText.do?mytext=%D1%84
>
> GET /Inter/takeText.do?mytext=%D1%84 HTTP/1.1
> Host: localhost:8080
> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11)
> Gecko/20071127 Firefox/2.0.0.11
> Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9
> ,text/plain;q=0.8,image/png,*/*;q=0.5
> Accept-Language: en-us,en;q=0.8,sr;q=0.5,hi;q=0.3
> Accept-Encoding: gzip,deflate
> Accept-Charset: ISO-8859-1,utf-8;q= 0.7,*;q=0.7
> Keep-Alive: 300
> Connection: keep-alive
> Referer: http://localhost:8080/Inter/takeText.do?mytext=%D1%84
> Cookie: JSESSIONID=yhhvgybm2jfa; sensitivity= 1000.0;
> JSESSIONID=AF8D24C63CE9C16D5DF78E5CDDE26146
>
>
>
> ***********************************************
> My HTML (rendered from the JSP)
>
>
> <html>
> <head>
>     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
>
> </head>
> <body>
>             <form name="InputLanguageForm" method="POST"
> action="/Inter/takeText.do" accept-charset="UTF-8" >
>                 <input type="text" name="mytext" value="">
>                 <input type="submit" value="Do it">
>             </form>
> </body>
> </html>
>
> ************************************************
>
> This is the configuration of the Tomcat Connector - if I REMOVE
> URIEncoding, both GET and POST don't work any more.
>
> <Connector port="8080" protocol="HTTP/1.1"
>                connectionTimeout="20000" URIEncoding="UTF-8"
>                redirectPort="8443" />
>
> ************************************************
>
>
> Thanks for any insight you can give me here...  I really don't want to
> change ALL my forms to GET - there should be
> an easier (and more natural) fix for this.
>
> Thanks, Alex.
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message