Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

UTF-8 in a JTextArea

JimmyButterflyJimmyButterfly Posts: 1Member
I am using Eclipse 3.5 on Windows 7 64-bit.

I have a UTF-8 string that prints fine on the console but when I try to print it in a JTextArea I get a square graphic for 3 of the 4 characters:

// Setup
query.textarea = new JTextArea(5,80);
query.textarea.setEditable(false);
query.textarea.setFont(new Font("Courier New", Font.PLAIN, 12));
JScrollPane wscrollpane = new JScrollPane(query.textarea);
JPanel wpanel = new JPanel();
wpanel.add(wscrollpane);
query.LDASOMwindow.getContentPane().add(wpanel);
query.LDASOMwindow.setSize(1100,700);
query.LDASOMwindow.setVisible(true);

// Code in question
String x = "TEST |u14c7 u14c4 u1557 u00d6|
";
query.textarea.append(x); // 3 boxes and correctly shows u00d6
System.out.println(x); // Prints all 4 characters fine

Any help would be greatly appreciated

-Jimmy Butterfly
Sign In or Register to comment.