views:

34

answers:

2

I am using JPA to insert into Mysql database and it is not able to persist symbols like double quotes(") or euro etc. instead of that it persist Que mark (?)

+1  A: 

Looks like some "Unicode problem".

Double check that you are using UTF-8 as character encoding for your tables/database (or maybe even as default CHARACTER SET). See 9.1.3. Specifying Character Sets and Collations.

Pascal Thivent
It's the table encoding. A wrong charset in connection string or HTTP request would only have produced [mojibake](http://en.wikipedia.org/wiki/Mojibake), not questionmarks. See also [this article](http://balusc.blogspot.com/2009/05/unicode-how-to-get-characters-right.html).
BalusC
@BalusC Wow, your article is simply... awesome.
Pascal Thivent
@BalusC Answer fixed, thanks.
Pascal Thivent
A: 

Thanks for ur reply It is not Unicode related problem i checked my character set form db to app server It is UTF-8

if i type the symbol it get inserted into db correctly but if i copied form somewhere else it insert mojibake.

romani
What do you mean by "copy"? How?
Pascal Thivent
How did you confirm that it persisted question marks in first place? You checked it using some DB admin tool, right? Because for example querying the data and writing it to stdout which doesn't support the encoding would have produced question marks as well. Mojibake will only occur when the data is decoded/encoded using the wrong encoding before/after being transferred as bytes from A to B.
BalusC