Re: Accented characters in TEXT field getting mangled
Jonathan Abrams <[email protected]>
| Newsgroups | gmane.comp.db.mysql.java |
|---|---|
| Message-ID | <[email protected]> |
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:[email protected]] > Sent: 01 September 2006 02:45 > To: [email protected] > 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 > > > -- MySQL Java Mailing List For list archives: http://lists.mysql.com/java To unsubscribe: http://lists.mysql.com/[email protected]