tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From albrecht andrzejewski <albrecht.andrzejew...@ema.fr>
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 :

  response.setContentType("text/html;charset=UTF-8");

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:

  response.setContentType("application/json;charset=UTF-8");

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="127.0.0.1" 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>
   ServerName serv1.xxx.tld
   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
   </Proxy>
   ProxyPass /bpc1/ ajp://localhost:8009/bpc1/
   ProxyPassReverse /bpc1/ ajp://localhost:8009/bpc1/
</VirtualHost>


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  
server...

Thanks by advance.


-- 
Albrecht ANDRZEJEWSKI
Créateur - Incubateur Technologique
***
http://haveacafe.wordpress.com/

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



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


Mime
View raw message