Of course that isn't UTF-8 but UTF-16. You should be able to use the formulae given in the links to convert UTF-16 to the n bytes required for UTF-8.[campbell@campbellscomputer java]$ java CharacterPrinter "Campbell Ritchie" e=mc² ر "ℙ(INT × INT)"
C = 0x0043
a = 0x0061
m = 0x006d
p = 0x0070
b = 0x0062
e = 0x0065
l = 0x006c
l = 0x006c
= 0x0020
R = 0x0052
i = 0x0069
t = 0x0074
c = 0x0063
h = 0x0068
i = 0x0069
e = 0x0065
e = 0x0065
= = 0x003d
m = 0x006d
c = 0x0063
² = 0x00b2
ر = 0x0631
ℙ = 0x2119
( = 0x0028
I = 0x0049
N = 0x004e
T = 0x0054
= 0x0020
× = 0x00d7
= 0x0020
I = 0x0049
N = 0x004e
T = 0x0054
) = 0x0029
Sarmad Thebo wrote:
Now is there any way to find out UTF-8 value of لاهور ? Something like this \u0644 !
Of course you can use the equals() method on Arabic text.
But text fields are not intended for entering options. They are intended for entering data. More a case of name = nameField.getText();
You would usually use buttons or menu items for options.
Something went wrong with the copy and paste on the Arabic text when I ran that little program. The original on the terminal looked a lot better. Where the = is at the very left, a space has been missed out by the software.ery
Arabic (the script), Sindhi (the language), it doesn't matter. You don't need to mess with UTF-8 or UTF-16 for ordinary String processing since both of those are fully supported by Unicode and Java fully supports Unicode.
Now you might have to make sure you've chosen a suitable font for your Swing components. That would be one which supports all of the characters you need to use. (Google "Sindhi font" if you don't already have one.) You should also make sure your keyboard is configured to support those characters too.
You may well find that Sindhi web pages are encoded in UTF-8; there's nothing special about that, I always encode my web pages in UTF-8 even though they are in English. UTF-8 can represent all Unicode characters.
Consider Paul's rocket mass heater. |