I'm migrating a servlet/JSP application from ISO-8859-1 to UTF-8. I use Mysql 5.0.45 which is UTF-8 configured and Tomcat 5.5.12. I manage to read UTF-8 characters from database and display them in HTML page. Submitting form data with UTF-8 character is also successful. The problem is when i execute an update query, UTF-8 characters in SQL request are damaged. Problem occurs in JVM around DBCP and jdbc driver, not in database.
I tested direct use of driver with DriverManager like this : Connection co = DriverManager.getConnection(...,...,...); co.createStatement().executeUpdate(query); and it's ok, UTF-8 characters are written correctly in database.
If i use connection from DBCP pool, character UTF-8 are considered as ISO 8859-1.
If a run Tomcat with -Dfile.encoding=UTF-8 JVM option, everything is ok ; but i can't use this work around because other applications use ISO 8859-1.
Someone has idea ? Thank's in advance
Olivier Debas
Greenhorn
Joined: Oct 30, 2007
Posts: 2
posted
0
When i use directly DBCP in my application to obtain connection, characters are well encoded in UTF-8. When i use datasource which is set up in Tomcat, character are damaged with ISO 8859-1 encoding. It seems that using Datasource is the cause of problems...