Problem displaying UNICODE characters on a JLabel
I am developing a small "educative" software that displays chinese characters on a JLabel.
Since I want to display a lot (only one at a time), I downloaded a TEXT file which contains the list of about 7'000 unicode for chinese characters. The file is basically just 1 column and ~7'000 rows and looks like this :
(Beginning of the file)
(End of the file)
My java program reads the file and loads all the unicodes in a vector. Then, what I do is that I create a new String and put somehow the concatenation of "\u" and a 4-digits unicode like for instance "4E00". The result of my concatenation is therefore "\u4E00". Finally, I put the result in my JLabel with the "setText" method.
It looks like this:
When I run my program, why does Java display "\u4E00" in the JLabel instead of displaying the corresponding chinese character ?
jLabelChar.setFont(new Font("SimSun",Font.PLAIN, 12)); // Sets an appopriate font to display chinese characters to the JLabel
String s1 = "\\u";
String s2 = getElement("D2B5"); // Will return the 4-digits unicode "4E00" in the vector as a String, according to a key (the key here is D2B5)
String s = s1.concat(s2);
Of course, if I just do like this...
...that works, but that's not what I want since I want to be able to take this unicode from a file.
Could anyone help me ? Try to be accurate as you can in your answer.
Thanks in advance for your help!