how to display non english words with unicode in java?
“\u0905\u092E\u0940\u0924\u093E\u092A” i have to display this ib Hindi?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Just have it in a String and display it. You only need to use the proper encoding in the display component/console.
UTF-8should suffice.This prints अमीताप in my Eclipse environment which is configured to use
UTF-8in its console.Edit: this ain’t going to work in for example the Windows command console, because it by default doesn’t use
UTF-8nor has a font which covers those codepoints. If you’re actually using Eclipse, then you can set the Workspace encoding in its preferences by General > Workspace > Text file encoding.Further on, anywhere where an Java API can take the character encoding as extra argument, then you need to make use of it and set it to
UTF-8. Otherwise the platform default encoding will be used, which may beISO-8859-1orcp1252, which is incorrect for those characters. If you for example want to write this String to someOutputStream, then you need to construct anOutputStreamWriterwhere in you passUTF-8as 2nd constructor argument. You may find this article useful as well.