Home » questions » How to convert Unicode representation into actual characters in Java?

How to convert Unicode representation into actual characters in Java?

2006-08-03 04:34:52, Category: Programming & Design
Hello. I have a Java string, e.g. "\u08aaa", representing the UTF-8 hex code for the character 說. How do I convert this string into the actual character 說? I've tried: String utfCode = "\u08aaa"; byte[] b = utfCode.getBytes(); String actualCharacter = new String(b, "UTF-8"); and all sorts of other similar operations, but none of them have worked. Is such a conversion possible in Java? Plz help me to resolve this. Thanks, Ravi K.

Answers

  1. Ed

    On 2006-08-03 07:34:13


    You need to use java.io package instead of just String methods. See the tutorial linked beloe for example.