tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From albrecht andrzejewski <>
Subject utf8 encoding broken with tomcat and mod proxy ajp
Date Tue, 07 Oct 2008 17:05:47 GMT
I use a chat servlet deployed in tomcat 5.5.

Because i live in France, i need some special characters like é / à / ç.
When testing with my IDE (netbeans + tomcat 5.5) i've no problem with  
these characters, as i use UTF-8.

When serving the HTML canvas page, i declare UTF-8 encoding in the  
doGet() method of the servlet :


Chat messages are sent using http / POST, and according to the http  
specs, it should use the character encoding of the webpage. When the  
webapp receive a POST message, it make it available for all the users,  
using JSON. So i use:


when serving the new JSON chat messages (javascript native encoding is utf-8).

As i said, there is no matter when using it in my vanillia Tomcat  
bundled with the IDE. But when deploying and testing on the production  
server, there is no way to obtain these utf-8 characters!

My production server is setup with apache and mod_proxy_AJP, so i  
declare using UTF-8 to the AJP connector with this line:

<Connector port="8009" address="" enableLookups="false"  
redirectPort="8443" URIEncoding="UTF-8" protocol="AJP/1.3" />

I obviously added the AddDefaultCharset UTF-8 to my httpd.conf apache  
configuration file.

Here is my mod_proxy virtual host configuration:

<VirtualHost *:80>
   ProxyRequests Off
   ProxyPreserveHost On
   AddDefaultCharset UTF-8
   ErrorLog /var/log/apache2/apache.tomcat-serv1.error.log
   CustomLog /var/log/apache2/apache.tomcat-serv1.log combined
   RedirectMatch ^/$ /bpc1/
   <Proxy *>
      Order deny,allow
      Allow from all
   ProxyPass /bpc1/ ajp://localhost:8009/bpc1/
   ProxyPassReverse /bpc1/ ajp://localhost:8009/bpc1/

I've looked at my HTTP headers.
The post header have this content type:
Content-Type	text/html;charset=UTF-8
The json response header given have this content type:
Content-Type	application/json;charset=UTF-8

But when the letter "é" is sent, "é" is received.

So i know this is not a pure Tomcat problem, but any help, any clue  
would be appreciated, i probably missed something when configuring the  

Thanks by advance.

Créateur - Incubateur Technologique

Ce message a ete envoye par le serveur IMP de l'EMA.

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

View raw message