0

I have a string of unicode characters like this:\u4f60\u597d in Java But when I print it to the console the it shows "??". Also when I update a Mysql table with this data it saves the same "??" string. I have set the Mysql charset to utf8 but it is not working

Jain
  • 854
  • 5
  • 15
  • And the question is? Show some code, the way the database is defined, etc. Also, `\u4f60\u597d` is the UTF-16 representation of a Unicode code point – fge Mar 14 '14 at 11:44
  • @fge The question is too obvious, If you dont get it you'll never get it.Nevertheless, the question is how can I add support for unicode characters in java and mysql. – Jain Mar 14 '14 at 11:51
  • 1
    The console probably uses Windows-1252 or so and cannot represent the text; for MySQL also the connection string, url, must specify UTF-8 transport too: http://stackoverflow.com/questions/138948/how-to-get-utf-8-working-in-java-webapps – Joop Eggen Mar 14 '14 at 11:52
  • I am afraid there is _no_ question there. All you say is "it doesn't work", you don't provide any material other than that (how you have set up your database, how you write to the database, etc). – fge Mar 14 '14 at 11:55

1 Answers1

1

If you are checking the output in some IDE, you need to set the character encoding there. Same for the MySql client editor that you are using. If you are using eclipse IDE, you can change it from Windows>Preferences>General>Workspace

Hirak
  • 3,601
  • 1
  • 22
  • 33