2

I am trying to convert the Devanagari Unicode to its character in Java and trying to display on CMD but it gives me a ? character.

Here is my code:

public class ConvertUnicode
{
    public static void main(String args[])
    {
        int a = 0x0909;
        char c = (char)a;
        System.out.println("  "+c);
    }
}

Output of above code is a ? character.

luiges90
  • 4,493
  • 2
  • 28
  • 43
user2181542
  • 61
  • 1
  • 1
  • 4
  • 1
    It is possible that your console, not the java program, is unable to output the Devanagari character, because the console font do not have the glyph. – luiges90 Mar 29 '13 at 06:48
  • 1
    If you write it to a File and specify "UTF8" as the encoding, how's it look? – Daniel Kaplan Mar 29 '13 at 06:49
  • possible duplicate of this: http://stackoverflow.com/questions/1035388/unicode-output-on-windows-command-line – Naytzyrhc Mar 29 '13 at 09:42
  • @luiges90 nope, you get a `?` per character that cannot be encoded in target encoding. – Esailija Mar 29 '13 at 11:58
  • Hey guys thanks for your reply. I tried it by changing the file encoding type to "UTF8" also, I changed the console font to Lucida but still I am facing the same problem. – user2181542 Mar 31 '13 at 13:24
  • If any one have the code which convert Unicode to it's proper character please post it so, that I can refer the code and try to convert Devnagari unicode to it's original character. – user2181542 Mar 31 '13 at 13:28

0 Answers0