I had a similar problem storing German text in a Postgresql database under
Mac OS X. I discovered that


1) Java stored data in the database in UTF-8;
2) Java does not necessarily read Strings in the format you would expect.


I populated the database from a Microsoft Excel source using a Java
program and POI. I converted the strings from POI to whatever Java uses
internally using the following function:

private static String toJava( String cp1252 ) {
try {
return new String( cp1252.getBytes(), "Cp1252" );
} catch( Exception e ) {
e.printStackTrace( System.err );
}
return cp1252; //dummy value to keep the compiler happy: we never get here
}


The Postgresql JDBC put the stuff into the database in UTF-8 format. Perhaps
the MySQL JDBC does something similar.


The Mac seems to prefer something called Mac OS Roman to ISO 8859-1. I have
decided to use UTF-8 as "lingua franca" and hope that Deli or something
similar will allow me to generate whatever the client actually wants.


I didn't have to fiddle with the JVM parameters.

Perhaps this helps you...

Cheers
Steve


On 5 Mar 2004, at 17:42, Alexander Schatten wrote:


Alexander Schatten wrote:


JAVA_OPTIONS='-Dfile.encoding=iso-8859-1'


I read the Sun documentation now, and extended this to:

-Dfile.encoding=iso-8859-1 -Duser.language=de -Duser.country=DE -Duser.variant=MAC


additionally,


-- the LANG=de_DE.iso-8859-1
-- the two encoding init params in web.xml are iso-8859-1


It still does not work to send and retrieve german umlauts from Cocoon to mysql... (mentioned again: the same cocoon webapp works without problems on an english RedHat 9 server)



now I really have no more ideas...



please, any other comments?



thanks



Alex



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to