tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Александър Шопов <>
Subject Yet again a problem with POSTs and encodings
Date Mon, 03 Dec 2007 15:06:32 GMT
Hi guys,
I went through the documentation and recent posts to the list, yet I 
cannot solve my problem.
My problem is that I am trying to POST non ASCII data to tomcat, but it 
gets recoded in ISO8859-1 interpretation of UTF-8 byte sequence.

OK. Here are some more data for my setup
Fedora 8, LANG=bg_BG.UTF-8
Sun JDK 1.5.0_13

Tomcat - I tried both 6.0.14, and 5.5.25

in server.xml I have put:
URIEncoding="UTF-8" in the conf/server.xml files.

I have exported JAVA_OPTS:


It is in fact used by tomcat:

ps fax | grep -i java  gives
30089 pts/3    Sl     0:03 /opt/jdk1.5.0_13/bin/java 
-Xdebug -Xrunjdwp:transport=dt_socket,address=9000,server=y,suspend=n 
-Djava.endorsed.dirs=/home/ash/apache-tomcat-6.0.14//endorsed -classpath 

org.apache.catalina.startup.Bootstrap start

Yet this extremely simple jsp gives wrong results:

cat webapps/ROOT/test.jsp:

<%@ page language="java" contentType="text/html;charset=UTF-8"%>
     <form action="test.jsp" method="post">
       <input type="text" name="field" />
       <input type="submit" name="submitButton" value="submitter" />
     <hr />

when I enter:
тест in the filed  - I get тест - which is ISO 8859-1 interpretation 
of the utf-8 encoded value.

However - when I change the method to GET or simply do a GET to the 
resource with parameters - everything works fine - Cyrillic gets decoded 
just fine.

I logged the browser requests - they are fine:


POST /test.jsp HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (X11; U; Linux i686; bg-BG; rv: 
Gecko/20071126 Fedora/ Firefox/

Accept-Language: bg,en-us;q=0.7,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://localhost:8080/test.jsp
Cookie: JSESSIONID=FEA5A7A61C620D7E4108B7BE85658378
Content-Type: application/x-www-form-urlencoded
Content-Length: 53
HTTP/1.x 200 OK
Server: Apache-Coyote/1.1
Content-Type: text/html;charset=UTF-8
Content-Length: 199
Date: Mon, 03 Dec 2007 15:05:57 GMT

I am obviously doing something very wrong but cannot guess it. Any ideas?

Kind regards:

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message