JDK-4414004 : Regression: cannot input/edit Japanese on AWT TextArea on Windows
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.4.0
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_nt
  • CPU: x86
  • Submitted: 2001-02-09
  • Updated: 2001-09-25
  • Resolved: 2001-05-01
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
1.4.0 betaFixed
Related Reports
Relates :  
Relates :  
Description
Since b43 build, Japanese text cannot be handled on AWT TextArea.  The following problems are observed:

1. Cannot input Japanese.  When the user commits Japanese text from the input method, it gets garbled.
2. Caret movement is incorrect.  You need to hit left/right arrow key twice to move caret over Japanese characters.
3. cut/paste of Japanese text sometimes does not work.

I confirmed that backing out the fix for 4341196 could avoid the problem.

naoto.sato@Eng 2001-02-09

I should have commented about the OS version more specific.  I confirmed that it worked fine on the following platforms:

- Windows 98 Japanese
- Windows 2000 English + MultiLanguage version w/ Japanese system/user locale selected

But the problem still persists on Windows NT 4.0 Japanese (SP6).

Regarding the problem on WinNT4.0SP6 with Japanese IME installed, I suppose that it was English NT plus Japanese Global IME.  We have not supported Global IME yet, so it was the expected behavior.  Please refer to 4225472.

naoto.sato@Eng 2001-02-13

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: merlin-beta FIXED IN: merlin-beta merlin-beta2 INTEGRATED IN: merlin-beta merlin-beta2 VERIFIED IN: merlin-beta3
14-06-2004

EVALUATION Commit to fix in Merlin-beta (serious regression). eric.hawkes@eng 2001-02-11 Name: dmR10075 Date: 02/13/2001 ###@###.### Win2000: It seems there are no problems mentioned in report in Merlin b48 - I can type, commit normally, move left/right one char step, copy/paste without the problems. WinNT4.0SP6 with Japanese IME installed: When I select Japanese locale in the TextArea no input method icon appear in the tray and the input is blocked until I switch focus to another editor. I was unable to type anything into TextArea in Japanese locale. Further experiments have shown that it happens always when I switch the locale using task bar. The source of this problem is the same as in 4402942 and fix is the same. Even with this fix I was unable to activate IME and type any Japanese text. However this behaviour is similiar for different versions (1.3.0c, 1.3.1b15, 1.4b48, 1.4b34) - when I switch to Japanese locale IME does not activate and the input continues in English. Tracing of the events have shown that Java does not reveive IME_SETCONTEXT message and the call to ImmCreateContext returns NULL with error 0x78 - This function is only valid in Windows NT mode. I don't know what it means but furhter Imm<..> calls deal with NULL context and therefore IME does not appear on the screen with Java. It is strange becasue several other applications like IE or Netscape work fine with this IME and allow me input Japanese text. I found the reference to this problem in the IMA forum but I didn't get information about how to avoid it. I tested MultiUI IME sample from MSDN, it works correctly on WinNT4.0(Japanese version) but doesn't work at all(even default IMC/default IME) on WinNT4.0(Japanese IME installed). I have no idea how IE and Netscape work in such an environment. WinNT4.0SP5 (Japanese version): I verified that with the fix to the problem with blocking there is no more problems - type, move, copy/paste work fine. ====================================================================== Name: dmR10075 Date: 02/19/2001 ###@###.### After the long cooperative investigation with Naoto we had discovered that the problem is in the 'wrong' RichEdit dlls. The original Japanese NT4 contains special riched32.dll and riched20.dll with a support (or bugfixes) of IME(or Japanese IME): Japanese NT4's riched32.dll has Language property as Japanese language. AWT loads riched32.dll. With 'correct' dlls it works fine while with 'wrong' it works like as Naoto described. Replacing 'wrong' dlls with 'correct' ones fixed the problems. Here is how one could differ the 'wrong' from 'correct' dlls: In my WinNT4.0(SP6) with Japanese IME (normal WinNT4.0, I have the following dlls ('wrong' dlls when they appear in Japanese NT): 431376 riched20.dll file version 5.30.22.2300, product version Rich Edit 3.0, language Neutral 174352 riched32.dll file version 4.00.993.4, product version Rich Edit 4.0, language English(US) In my Japanese WinNT4.0(SP5) naturaly Japanese I have the following dlls ('correct' dlls): 268560 riched20.dll file version 5.0.122.2, product version Rich Edit 2.0, language English (US) 207888 riched32.dll file version 4.00.835.1.381, couldn't find product, language Japanese language. We found that 'wrong' dlls could be installed for instance by english VC++. Presumably others non-Japanese versions of software can cause such problems. Unfortunately, reinstalling the Service pack (which contains correct dlls I assume) didn't help to fix the problem. May be it is because English versions are a bit newer than Japanese (it is seen from information presented above). ====================================================================== Name: dkR10074 Date: 04/27/2001 ###@###.### 2001-04-27 The fix detects the situation when RichEd32.dll version is wrong and displays a message that warns about possible problems and suggests that the user reads appropriate place in release notes on how to work around this problem. The following files need to be changed: awt_dlls.cpp awt.properties awt_de.properties awt_es.properties awt_fr.properties awt_it.properties awt_ja.properties awt_ko.properties awt_sv.properties awt_zh_CN.properties awt_zh_TW.properties All the properties files have to include the following text: ------8<------------- # Warnings AWT.InconsistentDLLsWarning=Text based operations may not work correctly due to an inconsistent set of dynamic linking libraries (DLLs) installed on your system. For more information on this problem and a suggested workaround please see the Java(TM) 2 SDK, Standard Edition, v1.4 Release Notes on java.sun.com. ------8<------------- ======================================================================
11-06-2004

SUGGESTED FIX Name: dkR10074 Date: 04/27/2001 ------- awt_dlls.cpp ------- *** g:\temp\geta1368 Tue Apr 24 16:56:52 2001 --- awt_dlls.cpp Tue Apr 24 16:45:52 2001 *************** *** 240,248 **** return; } ! if (::LoadLibrary("RICHED32.DLL") == NULL) { JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); JNU_ThrowInternalError(env, "Can't load RICHED32.DLL"); } initialized = 1; } --- 240,342 ---- return; } ! HMODULE lib = ::LoadLibrary("RICHED32.DLL"); ! if (lib == NULL) { JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); JNU_ThrowInternalError(env, "Can't load RICHED32.DLL"); + } else { + char *szFullPath = new char[_MAX_PATH]; + DWORD dwVerHnd = 0; + DWORD dwVersionInfoSize; + LPVOID lpVersionInfo; + UINT uLength = 0; + struct LANGANDCODEPAGE { + WORD wLanguage; + WORD wCodePage; + } *lpTranslate; + + try { + if (::GetModuleFileName(lib, szFullPath, _MAX_PATH)) { + load_version_procs(); + dwVersionInfoSize = (*get_file_version_info_size)(szFullPath, &dwVerHnd); + if (dwVersionInfoSize) { + lpVersionInfo = new BYTE[dwVersionInfoSize]; + try { + if ((*get_file_version_info)(szFullPath, + dwVerHnd, + dwVersionInfoSize, + lpVersionInfo) + && (*do_ver_query_value)(lpVersionInfo, + "\\VarFileInfo\\Translation", + (LPVOID*)&lpTranslate, + &uLength)) { + + if (::GetSystemMetrics(SM_DBCSENABLED) + && LANGIDFROMLCID(::GetThreadLocale()) != lpTranslate[0].wLanguage) { + + JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); + if (env->PushLocalFrame(6) >= 0) { + jstring keystr = env->NewStringUTF("AWT.InconsistentDLLsWarning"); + jstring defstr = env->NewStringUTF( + "Text based operations may not work correctly due to + an inconsistent set of dynamic linking libraries (DLLs) installed on your + system. For more information on this problem and a suggested workaround + please see the Java(TM) 2 SDK, Standard Edition, v1.4 Release Notes + on java.sun.com."); + + jstring retstr = + (jstring) JNU_CallStaticMethodByName( + env, + NULL, + "java/awt/Toolkit", + "getProperty", + "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;", + keystr, + defstr).l; + + jboolean exception; + jstring pkgstr = env->NewStringUTF("java.awt"); + jobject logger = + (jobject) JNU_CallStaticMethodByName( + env, + &exception, + "java/util/logging/Logger", + "getLogger", + "(Ljava/lang/String;)Ljava/util/logging/Logger;", + pkgstr).l; + + jstring msgstr = (retstr) ? retstr : defstr; + if (!exception) { + JNU_CallMethodByName( + env, + NULL, + logger, + "warning", + "(Ljava/lang/String;)V", + msgstr); + } else { + const char *outstr = JNU_GetStringPlatformChars(env, msgstr, NULL); + fprintf(stdout, "\nWARNING: %s\n", outstr); + fflush(stdout); + JNU_ReleaseStringPlatformChars(env, msgstr, outstr); + } + + env->PopLocalFrame(NULL); + } + } + } + } catch (...) { + delete[] lpVersionInfo; + throw; + } + delete[] lpVersionInfo; + } + } + } catch (...) { + delete[] szFullPath; + throw; + } + delete[] szFullPath; } initialized = 1; } ======================================================================
11-06-2004