3 Replies Latest reply on Dec 11, 2003 12:59 PM by juha

    UTF-8 problems with persisted Strings

    cvandyck

      I'm having this problem using JBoss 3.2.1 and either mysql 4.0 or SQLServer.

      Basically I have UTF-8 data that is being submitted by user form into my system, which then gets stored as Strings thru CMP into my entities. While the JBoss container is running, the unicode data displays correctly for my entities.

      However, when I restart JBoss, and those entities are reloaded from the data store, the characters get garbled.

      I have changed the default character encoding of my JVM to be UTF-8.

      I think that what is happening is that it is storing the information incorrectly into the database, but because of the entity bean caching, and because the default character encoding of the JVM is UTF-8, I believe that is why it works with submitted data correctly up until I restart JBoss.

      I've looked for ways to specify that the Strings being inserted into the database should be converted to UTF-8 byte streams (and vice versa), but I cannot find out how to do this.

      Also, I've looked in the database, and for characters like e(accent), it appears to be stored correctly, which is confusing.

      Thanks for any help.