Closed Bug 15657 Opened 25 years ago Closed 25 years ago

[key]The nsWindow::ProcessMessage MW_CHAR should not assume the data is in ACP

Categories

(Core :: Internationalization, defect, P1)

x86
Windows NT
defect

Tracking

()

VERIFIED FIXED

People

(Reporter: ftang, Assigned: ftang)

References

Details

(Whiteboard: fix check into keyEvent branch. Need to land to tip)

I think this is realated to bug 14845. What happen is the following code call IsDBCSLeadByte.
But if you read the documentation of IsDBCSLeadByte ( http://msdn.microsoft.com/library/specs/s1cea7.htm ), it say
Comments:

     The system ACP is used to check the ranges.

Therefore the code is not good if both (a) the ACP is a double byte code page, such as Chinese/Japanese/Korean (CP 932,936,949,950) and (b) the data
is not in ACP (say mCurrentKeyboardLayout is not ACP). This is one of the reason why we cannot type Greek/German/Cyrillic character in Japanese
Window . There are other problem about the switching itself.

Tague, when will we got MW_CHAR ? Will we get it even when IME is on ? We probably need a version of IsDBCSLeadByte which take the
mCurrentKeyboardCP as input.

http://lxr.mozilla.org/mozilla/source/widget/src/windows/nsWindow.cpp
2396  case WM_SYSCHAR:
2397     case WM_CHAR:
2398       {
2399         unsigned char ch = (unsigned char)wParam;
2400         UINT      char_result;
2401
2402         //
2403         // check first for backspace or return, handle them specially
2404         //
2405         if (ch==0x0d || ch==0x08) {
2406           mHaveDBCSLeadByte = PR_FALSE;
2407           result = OnChar(ch,ch==0x0d ? VK_RETURN : VK_BACK,true);
2408           break;
2409         }
2410
2411         //
2412         // check first to see if we have the first byte of a two-byte DBCS sequence
2413         //  if so, store it away and do nothing until we get the second sequence
2414         //
2415         if (IsDBCSLeadByte(ch) && !mHaveDBCSLeadByte) {
2416           mHaveDBCSLeadByte = TRUE;
2417           mDBCSLeadByte = ch;
2418           result = PR_TRUE;
2419           break;
2420         }
2421
2422         //
2423         // at this point, we may have the second byte of a DBCS sequence or a single byte
2424         // character, depending on the previous message.  Check and handle accordingly
2425         //
2426         if (mHaveDBCSLeadByte) {
2427           char_result = (mDBCSLeadByte << 8) | ch;
2428           mHaveDBCSLeadByte = FALSE;
2429           mDBCSLeadByte = 0;
2430           result = OnChar(char_result,ch,true);
2431         } else {
2432           char_result = ch;
2433           result = OnChar(char_result,ch,false);
2434         }
2435
2436         break;
2437       }
Status: NEW → ASSIGNED
Target Milestone: M11
Priority: P3 → P1
Summary: The nsWindow::ProcessMessage MW_CHAR should not assume the data is in ACP → [key]The nsWindow::ProcessMessage MW_CHAR should not assume the data is in ACP
Whiteboard: fix check into keyEvent branch. Need to land to tip
Blocks: 16127
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
fix in keyEvent_19991004_BRANCH landing
QA Contact: teruko → ftang
verified
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.