I am trying to use thai characters with their unicode values.
As far as I know, this can be done by prepending '\u', to the unicode values. (eg, \u0e04) If I do it this way, String thaiMsg = "\u0e04"; System.out.println(thaiMsg); this works perfectly, but in my case, this 0e04 is not static, I get it dynamically, so what I am doing now is : String unicode = "0e04"; //value available from some function String thaiMsg = "\\u" + unicode; System.out.println(thaiMsg); Now, just see the output of the string printed in both the above cases and see the difference.
Is there some solution to this problem?
Is there some other way of representing the character with its unicode value ?
The "\uxxxx" format is for compile time constants - it is translated by the compiler. For dynamic string building you can use a char or int variable. (right off the top of my head) int someInt = 0x0e04 ; char myThai = (char) someInt ; String thaiMsg = "" + myThai ; or String thaiMsg = Character.toString( myThai ); Bill