cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Krzysztof Zielinski <>
Subject [C2] I have problem with writing correct encoded strings to database.
Date Mon, 14 May 2001 13:14:59 GMT

I have a problem with writing correct encoded strings to database (in Cocoon2).

I have prepared example table (Mysql DB) and entered some text in
national encoding to table (from MySql console, text was encoded in ISO-8859-2). 
I have tested it and it was correct shown under C2 esql and SQLProcessor.

I have to insert text to database by the help SQLProcessor with
correct encoding. Example documents which used SQLTransformer made
wrong inserts (Strings was bad encoded).  
I have checked Cocoon2 logs and I have found there all sql's. All of
the SQL were encoded in "ISO-8859-2" !. STRAGE.

1.I don't know why fields are encoded different after committing to database.
2.I don't know why C2 logs are encoded in ISO-8859-2. (My OS have
   ISO-8859-2 encoding)
   I guess that java takes OS encoding and translate logs from UTF to iso-88859-2.
   Does it?
3. Does Java takes OS default encoding and then change SQL encoding
   from UTF to ISO-8859-2 (and send by JDBC to Databse)?

I have Linux Redhat with Sun Jdk 1.2 and Mysql with ISO-8859-2 encoding.
Tomcat instance have UTF-8 encoding eg: export LC_ALL="pl_PL.UTF-8:en.UTF-8"

There is example of my trouble in attachment.
To run this example please:
1. Unpack my example to your site eg webapps/[myapp]/sub/
2.Create in mysql database table test_sql
        CREATE TABLE test_sql (
          id int(11) DEFAULT '0' NOT NULL auto_increment,
          value varchar(255) DEFAULT '' NOT NULL,
          PRIMARY KEY (id)
3.Create connection called "podroze1" to this database

4. Copy to prepared SQLTransformer classes from direcotry
classes_and_source/classes to directory eg: webapps/[myapp]/Web-inf/classes/ 

5. restart c2server

6. fly to eg : localhost/sub/welcome


Best regards,
  ICQ # 47933362
View raw message