UTF-8 in a JTextArea - Programmers Heaven

Howdy, Stranger!

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

Categories

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.