Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes JDBC and the fly likes Unicode Characters Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Unicode Characters" Watch "Unicode Characters" New topic
Author

Unicode Characters

M. White
Greenhorn

Joined: Dec 27, 2009
Posts: 18

Everytime I fetch data (mostly strings ) from mysql database, several characters were replaced by "??". Is there a way I can preserve the original value? Thanks for the help.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42908
    
  69
Which characters are those, and how do you know they went bad - are you printing them to a console? If so, be aware that many console can't handle anything but ASCII.
M. White
Greenhorn

Joined: Dec 27, 2009
Posts: 18

Characters like ’ and é. I displayed it in eclipse console. By the way, I changed the Encoding to UTF-8 in Preferences-General-Editor. Also in debug mode, when i view the values in the Variables tab, the characters were also replaced by ??. Thanks for the response.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42908
    
  69
I don't know whether the Eclipse console (or Variables tab) can handle Unicode; you might want to verify that by in other way.
And just to ask the obvious: the DB encoding is set to something that can handle those characters, and they are still OK in the DB?
M. White
Greenhorn

Joined: Dec 27, 2009
Posts: 18

Yes. The values are still preserved in the db.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unicode Characters