views:

1365

answers:

3

Im having an issue at the moment where my testing environment is not persisting the trademark character "™" in the database. When I enter in the form data, then submit it, I can see that on the server side, the request has the correctly encoded ™ character, but then when the call to hibernate's "saveOrUpdate()" method is called, the data in the table shows up as an upside down question mark.

Im using SqlDeveloper to inspect the table, and I can manually change the character to a ™ by pasting directly into the row then committing, and it works.

So I have made the assumption that hibernates methods of persistence are not working correctly.

Im at a loss here, really, I just dont know what to try, I have set the:

<property name="connection.useUnicode">true</property>
<property name="connection.characterEncoding">utf-8</property>

properties in the config file, with no luck.

My columns in the tables are NVARCHAR2(400 CHAR) (although they were originally, just VARCHAR2 to start with, but I changed them during the debugging of this issue).

Any help here is greatly appreciated.

Mark

+2  A: 

Ok, so it turns out that what I needed to do was to set the defaultNChar connection property to true

I did this via the context file for my app in tomcat.

The article that enlightened me was here:

http://www.mularien.com/blog/2007/12/11/solving-problems-with-international-utf-8-data-using-hibernate-oracle-and-tomcat/

I would be happy to answer anymore questions if someone else has the same issue as me, just email me!

Mark
A: 

Yeah Mark, I am also facing exactly the same problem, please suggest me also if you have any solution now.

Regards, Jaggit

Jaggit
A: 

Sorry for again !!!!! .. :) My database is MySQL....!!!!!!!!!!!

Jaggit
Sorry Jaggit, Im not familiar with MySQL, so I cant really help you out here. But, are you using tomcat? Look up the connection details for tomcat applications connecting to MySQL, you might get lucky...
Mark