tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davefu <davef...@gmail.com>
Subject Encoding problem with Tomcat (hibernate) + Postgres
Date Wed, 24 Feb 2010 09:08:31 GMT

Hi, this is my setup:

- Debian Lenny 
- Tomcat 5.5
- Postgres 8.3 

I'm running an app which is failing everytime it tries to get some data from
the DB with characters like [ÁÉÍÓÚáéíóú]. By "failing" I mean the
application isn't showing the data it should when Tomcat throws querys to
Postgres.

- JDBC connection on hibernate.cfg.xml =
"jdbc:postgresql://localhost/familias?charSet='UTF8'"

- The DB is set with encoding = UTF8

- Locales on system are: 
server:~# locale
LANG=es_ES.UTF-8
LC_CTYPE="es_ES.UTF-8"
LC_NUMERIC="es_ES.UTF-8"
LC_TIME="es_ES.UTF-8"
LC_COLLATE="es_ES.UTF-8"
LC_MONETARY="es_ES.UTF-8"
LC_MESSAGES="es_ES.UTF-8"
LC_PAPER="es_ES.UTF-8"
LC_NAME="es_ES.UTF-8"
LC_ADDRESS="es_ES.UTF-8"
LC_TELEPHONE="es_ES.UTF-8"
LC_MEASUREMENT="es_ES.UTF-8"
LC_IDENTIFICATION="es_ES.UTF-8"
LC_ALL=

.jsps on screen shows correct codification on all the static data.

The logs look good on Tomcat: 
"...TRANSLATE(upper(e.NombreMadre),'ÁÉÍÓÚáéíóúñÑ', 'AEIOUAEIOUNN' ) like
TRANSLATE( UPPER('%MARÍA%')..."

but this is what Postgres shows on its logs: 
"...(TRANSLATE(upper(cxfaexpedi0_.nombre_madre),
'ÁÃ&#137;ÍÃ&#147;Ã&#154;áéíóúñÃ&#145;', 'AEIOUAEIOUNN')like
TRANSLATE(upper('%MARÍA%')..."

I've tried encoding the DB with LATIN1 and settting the JDBC connection to
LATIN1. The logs are good on both sides this time, but still the app is not
receiving the data on screen. Seems like somehow the query is not reaching
sane (due to bad encoding) to postgres, or postgres is not sending it back
to tomcat.

If I set system locale to ISO-8859-1, the data is displayed perfectly. Too
bad, since it must stay in UTF8.
Sorry for my english, and thanks in advance!

-- 
View this message in context: http://old.nabble.com/Encoding-problem-with-Tomcat-%28hibernate%29-%2B-Postgres-tp27714136p27714136.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


Mime
View raw message