> I have had similar problem with Cp1250 encoding(Tomcat and MySQL). You
> have to have in mind this was not done on Tomcat 4.x, but 3.x.
> This is what I have done:
> - <%@page contentType="text/html; charset=windows-1250"%> on top of
> every JSP file
I don't think that is a correct character encoding as far as Java is concerned. I
think Java supports only ISO-8859-* and UTF-*. Please correct me if I'm wrong
> - default_character_set=latin2 in my.cnf
Is there a way to set defaul character encoding for Tomcat? Setting LOCALLE on Unix?
> - created new database so it gets created in latin2 character set
Done that with PostgreSQL.
> - when I connected to MySQL I was using mm.mysql driver and the database
> URL was
> jdbc:mysql://hostname:port/database?characterEncoding=Cp1250&useUnicode=true
I've never used MySQL, just PostgreSQL. So, the database is ISO-8859-2 and this
converts it to CP-1250, which goes by as Latin-1, as far as Tomcat is concerned.
I have had a similar "success" with my setup: the database was Latin-1, the data in it
was win-1250 and when I forced JDBC connection to Latin-1 charset, it would pass
through JSP. But that is such a hack...
> Then all characters were correctly displayed on JSP pages.
What I'm looking for is a "politically correct" solution. I have so far:
- PostgreSQL with one Unicode and one ISO-8859-2 databases, both with the same data in
correct form.
- JDBC driver which is acting OK.
- JSP pages with correctly set pageEncoding
- Java Servlet with correctly set contentType/encoding
Still, Tomcat goes for default charset encoding and screwes up Latin-2 characters.
Any help?
Nix.