3 messages in com.mysql.lists.javaRe: Unicode to MySQL-charset conversion
FromSent OnAttachments
Michael Kofler13 Dec 2002 09:43 
Mark Matthews13 Dec 2002 14:03 
Michael Kofler16 Dec 2002 01:14 
Subject:Re: Unicode to MySQL-charset conversion
From:Mark Matthews (ma@mysql.com)
Date:12/13/2002 02:03:20 PM
List:com.mysql.lists.java

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1

Michael Kofler wrote:

Hi,

Connector/J automatically converts strings from Unicode (Java) to the charset used by the MySQL server. This seems to work well with current snapshot versions. (In 3.0.2, it did *not* work for me: MySQL-Server 4.0.4 with latin1 charset + Sun JDK 1.4.1 .)

Now the question: Connector/J seems to convert all Unicode characters which cannot be saved in the charset of the MySQL server to 0 codes. (I tested the snapshot of Dec. 13th 2002.)

Ahh, you know what, I misread your original question. Sorry.

If you use PreparedStatements to handle all of your Strings, then you won't have this problem. Solving it if you're using plain Statements is next to impossible. The problem is that Java really has no support for telling me what character is in a charset :(

Let me try one fix, and have you test it, and let me know how it goes...It'll take 15 minutes, or so, okay?

-Mark

- -- MySQL 2003 Users Conference -> http://www.mysql.com/events/uc2003/

For technical support contracts, visit https://order.mysql.com/?ref=mmma

iD8DBQE9+llFtvXNTca6JD8RArJFAJ0fJW3v0BtwhwChlKRXGp2X0U9YKgCdHask th6E7r9xe5Vf8Bpq38GnBX0= =z2Dv -----END PGP SIGNATURE-----