Java Swing - JTextField / JTextArea cannot insert extra Unicode characters

I did an exhaustive search for stackoverflow and Google, but so far I have not been able to find others having a similar problem.

In the Java Swing test program, I create a simple JTextField to try to insert characters from a web page (http://isthisthingon.org/unicode/) into it. When I test "㓿" (code 13567), it can insert a character. This symbol is the last symbol listed in the CJK plane of Ideographic Extension A. However, when I switch to the next sister plane, the CJK Ideograph Extension B, trying to copy and paste the symbol “𠀀” (code 131072), fails. It does not display a box or any glyph, it seems that I did not have anything in the system clipboard.

I understand that the CJK Ideograph Extension B extension is a set of characters that are considered “optional”, and they require two 16-bit blocks instead of one when Java encodes them internally as UTF-16. Further testing proves that I can display additional characters if I hard-code the text in the display area.

This has been tested using Windows 7 and Java 6.

I understand that with Java 5, support for additional unicode characters has been added, however, I am wondering why (or if) the cut and paste function in swing still does not allow me to insert these characters. Is there anything else I need to do to tell Java to process these characters when using the JTextField or JTextArea classes? Is there another way for Java Swing libraries to be able to insert these characters into a text box?

Thank you for your time!

+5
source share
1 answer

Before I could publish this, I could find my answer. This was a long bug in the JDK .

+2
source

All Articles