-
Bug
-
Resolution: Duplicate
-
P1
-
None
-
1.1.2
-
generic
-
solaris_2.5
With 1.1.2, display and input of Japanese text in TextField and TextArea
is broken. This used to work in 1.1 and 1.1.1.
Same problem happens when running in the zh_TW locale, i.e.,
display and input of Chinese charactors is broken in TextField and TextArea.
The following problem shows the problem.
import java.io.*;
import java.awt.*;
import java.awt.event.*;
public class TextAreaBug extends java.applet.Applet implements TextListener {
Frame frame;
TextArea ta;
String data = null;
public static void main(String args[]) {
String string;
if (args.length == 0) {
System.out.println("usage: java TextAreaBug filename");
return;
}
try {
FileReader reader = new FileReader(args[0]);
char buf[] = new char[1000];
int len;
len = reader.read(buf, 0, buf.length);
string = new String(buf);
} catch (Exception e) {
e.printStackTrace();
return;
}
Frame f = new Frame("TextArea test");
TextAreaBug clnt = new TextAreaBug(string);
clnt.init();
clnt.start();
f.add("Center", clnt);
f.resize(500, 300);
f.pack();
f.show();
}
public TextAreaBug(String string)
{
data = string;
}
public void init() {
ta = new TextArea("Test", 5, 20, TextArea.SCROLLBARS_NONE);
ta.setText(data);
add(ta);
ta.addTextListener(this);
}
public void textValueChanged(TextEvent e) {
TextArea textArea = (TextArea)e.getSource();
int id = e.getID();
System.out.println("textValueChanged called");
if (id == TextEvent.TEXT_VALUE_CHANGED)
System.out.println("\tevent ID is TEXT_VALUE_CHANGED");
else
System.out.println("\tevent ID is: " + id);
System.out.println("TextArea string: " + textArea.getText());
}
}
Sample data:
abc
\044\065\044\067\044\137
bye
is broken. This used to work in 1.1 and 1.1.1.
Same problem happens when running in the zh_TW locale, i.e.,
display and input of Chinese charactors is broken in TextField and TextArea.
The following problem shows the problem.
import java.io.*;
import java.awt.*;
import java.awt.event.*;
public class TextAreaBug extends java.applet.Applet implements TextListener {
Frame frame;
TextArea ta;
String data = null;
public static void main(String args[]) {
String string;
if (args.length == 0) {
System.out.println("usage: java TextAreaBug filename");
return;
}
try {
FileReader reader = new FileReader(args[0]);
char buf[] = new char[1000];
int len;
len = reader.read(buf, 0, buf.length);
string = new String(buf);
} catch (Exception e) {
e.printStackTrace();
return;
}
Frame f = new Frame("TextArea test");
TextAreaBug clnt = new TextAreaBug(string);
clnt.init();
clnt.start();
f.add("Center", clnt);
f.resize(500, 300);
f.pack();
f.show();
}
public TextAreaBug(String string)
{
data = string;
}
public void init() {
ta = new TextArea("Test", 5, 20, TextArea.SCROLLBARS_NONE);
ta.setText(data);
add(ta);
ta.addTextListener(this);
}
public void textValueChanged(TextEvent e) {
TextArea textArea = (TextArea)e.getSource();
int id = e.getID();
System.out.println("textValueChanged called");
if (id == TextEvent.TEXT_VALUE_CHANGED)
System.out.println("\tevent ID is TEXT_VALUE_CHANGED");
else
System.out.println("\tevent ID is: " + id);
System.out.println("TextArea string: " + textArea.getText());
}
}
Sample data:
abc
\044\065\044\067\044\137
bye
- duplicates
-
JDK-4055084 JDK/JRE 1.1.2 does not work properly in Japanese (or any non-ISO8859-1 codeset)
- Closed