My Oracle Support Banner

Java Swing Application Displays Space Characters in Wrong Position when Entering Korean Text on Ubuntu 16 (Doc ID 2405273.1)

Last updated on MARCH 31, 2023

Applies to:

Java SE JDK and JRE - Version 8 and later
Linux x86

Symptoms

A Java Swing application using the Korean Hangul input method on Ubuntu 16 does not enter space characters in expected places.

Two examples:

Caution

The sample code below is provided for educational purposes only, and is not supported by Oracle Support. It has been tested internally. However, we do not guarantee that it will work for you. Ensure that you run it in your test environment before using. Additionally, the code and object names used in this article represent fictitious sample names that make up an example. Any similarity to actual code is purely coincidental and not intended in any other manner.

 

1. When entering in a JTextField: '하나' on Ubuntu 16, the actual contents of text field are: '하 나'.  Note the space character is placed between blocks, rather than after them as expected. 

The issue can be reproduced at will with the following steps on a clean Ubuntu 16.04.1 installation:

  1. Add Korean language in Settings->Language Support,
  2. Add Korean(Hangul)(IBus) in Settings->Text Entry 
  3. Restart system
  4. Compile the JTextFieldTest.java program (below)  with command, 'javac JTextFieldTest.java'
  5. Run the JTextFieldTest program with command, 'java JTextFieldTest'
  6. Switch to Hangul input method, press Shift+Space to activate Hangul input and enter '하나 ' (to achieve this, press the following keys on standard English keyboard: 'G' 'K' 'S' 'K' ' '(space))
  7. Notice actual contents of text field: '하 나' (the space character is between blocks, not after them)
  8. Perform the above steps on Ubuntu 14
  9. Notice the contents of text field: '하나 ' (with the space character after blocks, as expected)

The following test program, JTextFieldTest.java, can be used to demonstrate the problem in this example:

These symptoms occur only after upgrading from Ubuntu 14 to Ubuntu 16.  On Ubuntu 14, the space characters are in the correct places in each of the above scenarios.  The issue does not occur with native applications (e.g. gedit) on either Ubuntu 14 or 16.

It is expected that the position of space characters in the Korean language should remain consistent in a Java SE application from one Linux version to the next.

Changes

 The problem can be seen after upgrading the Ubuntu Linux OS version to Ubuntu 16.

Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Symptoms
 Caution
Changes
Cause
Solution
References


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.