5 messages in com.mysql.lists.javaRe: Accented characters in TEXT field...| From | Sent On | Attachments |
|---|---|---|
| Jonathan Abrams | 31 Aug 2006 18:44 | |
| Keith Hatton | 01 Sep 2006 01:18 | |
| Edival | 01 Sep 2006 06:38 | |
| Marc Herbert | 01 Sep 2006 11:02 | |
| Jonathan Abrams | 01 Sep 2006 21:02 |
| Subject: | Re: Accented characters in TEXT field getting mangled![]() |
|---|---|
| From: | Jonathan Abrams (abr...@jabrams.com) |
| Date: | 09/01/2006 09:02:55 PM |
| List: | com.mysql.lists.java |
Marc Herbert's suggestion was the solution actually. I needed to use string reader and setCharacterStream().
Thanks!
Keith Hatton wrote:
Maybe your default character encoding is different on the two platforms.
String.getBytes() just uses the default encoding for the JVM, so it could
produce different results in the two environments. Try using a definite encoding
instead.
Hope this helps Keith
-----Original Message----- From: Jonathan Abrams [mailto:abr...@jabrams.com] Sent: 01 September 2006 02:45 To: ja...@lists.mysql.com Subject: Accented characters in TEXT field getting mangled
I am developing a web application using Java/Tomcat and MySQL 4.1.12 with Connector/J 3.13.13.
When I save something with an accent like "Café" to a VARCHAR column, it works fine on both my development Windows XP laptop, and our production Linux server.
When I save something with an accent into a TEXT column, it works fine on the Windows box, but the Linux systems return "Café".
The code I am using to set the TEXT column value is:
byte[] bytes = text.getBytes();
InputStream textInputStream = new ByteArrayInputStream(bytes);
preparedStatement.setAsciiStream(1, textInputStream, bytes.length);
Obviously I am doing something wrong since the unicode is getting messed up on the production db, although I'm confused as to why it's working ok on my dev windows box.
Do I need to be doing something different? setCharacterStream? setUnicodeStream? setClob() ?
Thanks! Jonathan




