GNU bug report logs - #10299
Emacs doesn't handle Unicode characters in keyboard layout on MS Windows

Previous Next

Package: emacs;

Reported by: Joakim Hårsman <joakim.harsman <at> gmail.com>

Date: Wed, 14 Dec 2011 20:42:02 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Jason Rumney <jasonr <at> gnu.org>
To: Joakim Hårsman <joakim.harsman <at> gmail.com>
Cc: lekktu <at> gmail.com, Eli Zaretskii <eliz <at> gnu.org>, 10299 <at> debbugs.gnu.org
Subject: bug#10299: Emacs doesn't handle Unicode characters in keyboard layout on MS Windows
Date: Tue, 07 Aug 2012 20:15:30 +0800
Joakim Hårsman <joakim.harsman <at> gmail.com> writes:

>>
>>   +/* Set text of w32 frame with handle HWND to TEXT.
>>   +
>>   +   We explicitly switch between the Unicode and ANSI version of
>>   +   SetWindowText because Emacs isn't compiled with UNICODE defined to
>>   +   retain compatibility with Windows 95. */
>>   +
>>   +static void
>>   +w32_set_frame_text (HWND hwnd, LPCSTR text)
>>   +{
>>   +  if (os_subtype == OS_NT)
>>   +    SetWindowTextW (hwnd, (LPCWSTR)text);
>>   +  else
>>   +    SetWindowTextA (hwnd, text);
>>   +}

> The change to SetWindowTextW for frame titles was needed because
> otherwise the frame title was cut short after the first character
> (presumably because the window class name is a UCS-2 wide string and
> the second byte therefore is null). This is exaclty the case they talk
> about at your link.

>>          if (STRING_MULTIBYTE (name))
>>   -       name = ENCODE_SYSTEM (name);
>>   -
>>   +        name = ENCODE_SYSTEM (name);
>>   +
>>          BLOCK_INPUT;
>>   -      SetWindowText (FRAME_W32_WINDOW (f), SDATA (name));
>>   +      w32_set_frame_text(FRAME_W32_WINDOW (f), SDATA (name));

But the above doesn't pass a UCS-2 wide string to SetWindowTextW.  It
passes an 8-bit string encoded in the system 8-bit encoding, then simply
casts it to a wchar_t!  You cannot possibly get the correct frame title using
this patch.






This bug report was last modified 12 years and 289 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.