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:

echo $JAVA_OPTS
-Dfile.encoding=UTF-8

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 -Dfile.encoding=UTF-8 -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file=/home/ash/apache-tomcat-6.0.14//conf/logging.properties -Xdebug -Xrunjdwp:transport=dt_socket,address=9000,server=y,suspend=n -Djava.endorsed.dirs=/home/ash/apache-tomcat-6.0.14//endorsed -classpath :/home/ash/apache-tomcat-6.0.14//bin/bootstrap.jar:/home/ash/apache-tomcat-6.0.14//bin/commons-logging-api.jar -Dcatalina.base=/home/ash/apache-tomcat-6.0.14/ -Dcatalina.home=/home/ash/apache-tomcat-6.0.14/ -Djava.io.tmpdir=/home/ash/apache-tomcat-6.0.14//temp 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"%>
<html>
  <body>
    <form action="test.jsp" method="post">
      <input type="text" name="field" />
      <input type="submit" name="submitButton" value="submitter" />
    </form>
    <hr />
    ${param['field']}
  </body>
</html>

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:

http://localhost:8080/test.jsp

POST /test.jsp HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (X11; U; Linux i686; bg-BG; rv:1.8.1.10) Gecko/20071126 Fedora/2.0.0.10-1.fc8 Firefox/2.0.0.10 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: 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
field=%D1%82%D0%B5%D1%81%D1%82&submitButton=submitter
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:
al_shopov

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to