Connector/J 3.0.2 encoding problems
am 17.11.2002 23:37:26 von Morten Norby LarsenConnector/J 3.0.2 on MacOSX 10.2.2
- but I don't think the platform matters.
UPDATE and INSERT statements in PreparedStatements result in erroneously
coded text when using setString() on strings with characters > 127.
The problem disappears if the encoding is explicitly specified (together
with the use of UniCode) in the propertylist when creating the
connection.
The error seems to stem from the fact that the bytearray charToByteMap
in the class SingleByteCharsetConverter is declared static.
Being static, it is re-written for each encoding, seemingly remaining
with the value of the last encoding in the list. This may be a problem
only for values < 256.
Removing the static declaration appears to solve the problem - while
increasing a little too much the memory footprint, of course.
How-To-Repeat:
Try this:
PreparedStatement stmt = conn.prepareStatement("UPDATE table SET
col=?");
stmt.setString(1, "æøå èéòù");
stmt.execute();
The contents of column col will be garbled.
Hope this can be of help,
Morten
--
------------------------------------------------------------ ------------
Morten Norby Larsen morten@magisterludi.com
Magister Ludi Phone: +39 02 26 11 72 80
Via Battaglia 8, I-20127 Milano, Italy Fax: +39 02 28 46 037
http://www.magisterludi.com
------------------------------------------------------------ ---------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail bugs-thread13012@lists.mysql.com
To unsubscribe, e-mail