Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Unicode in java

  Asked By: Anpu    Date: Aug 02    Category: Java    Views: 1102

I have a big problem on using unicode.
I know to process Unicode I should do like this:
JLabel Label = new Label("\u0645");

but the problem is that I want to do this dynamicly.
Imagine that you want to get the ASCII code from Input ,then you
want to convert the ASCII Code to Unicode so you do like this:

int input = ???; // you get the input

byte[] b = new byte[1];
b[0] = 92; // ASCII Code "92" is "\" Character
String s = new String(b); // so "s" become "\"

//Imagine we have a method which get the integer then parse String
as Hexa mode of Decimal
String Hexa = convertDecToHex(input);

JLabel Label = new Label(s+"u06"+Hexa);

if you do like this you will find different result;
I mean: "JLabel Label = new Label(s+"u06"+Hexa)" is different
by "JLabel Label = new Label("\u06xx") "

but 's+"u06"+Hexa' produce '\u06xx'



No Answers Found. Be the First, To Post Answer.

Didn't find what you were looking for? Find more on Unicode in java Or get search suggestion and latest updates.