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

4
  • 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 Commented Mar 14, 2014 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. Commented Mar 14, 2014 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: stackoverflow.com/questions/138948/… Commented Mar 14, 2014 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). Commented Mar 14, 2014 at 11:55

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.