5 messages in com.mysql.lists.javaRE: Simple (?) character encoding que...| From | Sent On | Attachments |
|---|---|---|
| Jaap | 11 Jun 2003 06:14 | |
| Dane Foster | 11 Jun 2003 07:30 | |
| Russ Tennant | 11 Jun 2003 10:16 | |
| Jaap | 11 Jun 2003 14:33 | |
| Jonathan Baxter | 11 Jun 2003 15:30 |
| Subject: | RE: Simple (?) character encoding question![]() |
|---|---|
| From: | Jaap (cont...@jaap.nl) |
| Date: | 06/11/2003 02:33:49 PM |
| List: | com.mysql.lists.java |
Hi Dane, Rusell,
Thank you for your response. Maybe my problem is more serious than it seems.
- The Byte-hack will not work because before I retrieve the information it is allready stored in error. And I use Statement.executeUpdate( String SQL ) to store information which does not support a byte input (so far I know).
- I tried the UTF-8 and the useUnicode property, without succes. Besides, I do not want UTF-8, latin1 should be fine for the Günther's and Gabriëlle's.
- Also Prepared Statement did not solve the problem (only slowed performance and added a generated keys problem - I really need that key!).
- I use Mysql 4.0.12. MySQL itself is very capable in holding latin1. mysql> INSERT INTO table ( name ) VALUES ( 'Gabriëlle' ); works fine
But,
Statement.executeUpdate( "INSERT INTO table ( name ) VALUES (
'Gabriëlle' )" ); as well as
prepareStatement( "INSERT INTO table ( name ) VALUES ( ? )" );
both will result in Gabri?lle.
How can you get a probably trivial latin1 jdbc-connection working?
Regards,
Jaap www.jaap.nl: alle woningen, één e-mail
----Original Message----- From: Dane Foster [mailto:dfos...@equitytg.com] Sent: Wednesday, June 11, 2003 4:31 PM To: Jaap; ja...@lists.mysql.com Subject: Re: Simple (?) character encoding question
The following is a quick hack that should work until you can get a 'real' answer.
Treat the data/string as raw bytes. Since you know what the encoding of a particular column is supposed to be all you do is:
byte[] stringValue = rs.getBytes( colNumber ); String germanString = new String( stringValue, "iso-8859-1" );
instead of: //hope the driver using the right encoding String germanString = rs.getString( colNumber );
The above workaround is for the MySQL 3.x release because it can be a pain in the butt to work w/ multi-byte character sets if the installation wasn't compiled w/ support for them. The 4.0.x and 4.1.x releases are much better at handling multi-byte character sets so it shouldn't even be problem.
Dane Foster
----- Original Message ----- From: "Jaap" <cont...@jaap.nl> To: <ja...@lists.mysql.com> Sent: Wednesday, June 11, 2003 09:15 Subject: Simple (?) character encoding question
Hi,
For some time I am trying to get my application to understand ISO-8859-1 characters like ë and é. But I cannot get it to work.
What have I tried? - mysql from console: it works fine! - Java application and Tomcat application: both will not work. - Statements and Prepared Statements (both will not work, PS even gives me extra problem for not retrieving the auto_increment values) - I have set jdbc-url with various options - Version 2.0.14 and 3.0.1 (later version gives me table-alias trouble)
Does anyone have a Hello World example how to make ISO-8859-1 work for Java and Tomcat?
Please, lately a lot of Germans subscribe on my website with names like G?nther and Gabri?lle...
Thank you for your time,
Jaap Stelwagen
_____________________________________
jaap b.v. oudezijds voorburgwal 1a 1012 eh amsterdam the netherlands
M +31 6 42229196 E cont...@jaap.nl
_____________________________________
Voor het actuele huizenaanbod, meld je aan bij www.jaap.nl
-- MySQL Java Mailing List For list archives: http://lists.mysql.com/java To unsubscribe: http://lists.mysql.com/java?unsub=dfos...@equitytg.com




