From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Joakim =?UTF-8?Q?H=C3=A5rsman?= Newsgroups: gmane.emacs.bugs Subject: bug#10299: Emacs doesn't handle Unicode characters in keyboard layout on MS Windows Date: Tue, 7 Aug 2012 21:49:49 +0200 Message-ID: References: <83vcph0w9t.fsf@gnu.org> <83obv821wv.fsf@gnu.org> <831us31atj.fsf@gnu.org> <83pqflzr1d.fsf@gnu.org> <836298hrdt.fsf@gnu.org> <87txweq4nx.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1344369111 26845 80.91.229.3 (7 Aug 2012 19:51:51 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 7 Aug 2012 19:51:51 +0000 (UTC) Cc: lekktu@gmail.com, 10299@debbugs.gnu.org To: Jason Rumney Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Aug 07 21:51:50 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Sypoj-0008IP-Ll for geb-bug-gnu-emacs@m.gmane.org; Tue, 07 Aug 2012 21:51:49 +0200 Original-Received: from localhost ([::1]:50082 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sypoj-0001Jq-2D for geb-bug-gnu-emacs@m.gmane.org; Tue, 07 Aug 2012 15:51:49 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:44981) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sypn4-0005tL-Qe for bug-gnu-emacs@gnu.org; Tue, 07 Aug 2012 15:50:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sypn0-0006Si-Se for bug-gnu-emacs@gnu.org; Tue, 07 Aug 2012 15:50:04 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:59051) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sypn0-0006SS-NT for bug-gnu-emacs@gnu.org; Tue, 07 Aug 2012 15:50:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1Sypuk-0005MR-B1 for bug-gnu-emacs@gnu.org; Tue, 07 Aug 2012 15:58:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Joakim =?UTF-8?Q?H=C3=A5rsman?= Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 07 Aug 2012 19:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 10299 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 10299-submit@debbugs.gnu.org id=B10299.134436947420592 (code B ref 10299); Tue, 07 Aug 2012 19:58:02 +0000 Original-Received: (at 10299) by debbugs.gnu.org; 7 Aug 2012 19:57:54 +0000 Original-Received: from localhost ([127.0.0.1]:40363 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Sypub-0005M5-KQ for submit@debbugs.gnu.org; Tue, 07 Aug 2012 15:57:53 -0400 Original-Received: from mail-yw0-f44.google.com ([209.85.213.44]:42294) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SypuY-0005Lx-HD for 10299@debbugs.gnu.org; Tue, 07 Aug 2012 15:57:51 -0400 Original-Received: by yhq56 with SMTP id 56so4230828yhq.3 for <10299@debbugs.gnu.org>; Tue, 07 Aug 2012 12:49:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=RdVvOHYTdQvnCIwMzeGDj27gI+sVjpnWpBAtTTSigsQ=; b=b43app5Y++x4g5/01LSKShO9/IljXJKf2amlasYvBr2x5IAfzUJScgL8QAZU1UUm0d hbJMx+KJhHNlaQHZZm8g2oZneZ+JlBuQHFHQXDIGTJHuTckGLAa9YTsD3guVb8vjNCEX rSCqP6cF1poVLYEvAcBdxuZUFort5zkU5hG72miLvk/rU+Q/4tQgXuZG0wIzSOivL43V B55Xy2hCLi/5EklUDVqMHqIOyQ7kvM51UdTC2a9FSuVrapZckx2m+0tcVdN3eUBUNW8u zvxEKdiVUPPTNfqWDeq28R/2lkV2AM72xr5vHYExXsEIboEvnFruBpSN+RP3NjIrxcW7 mFHg== Original-Received: by 10.50.236.4 with SMTP id uq4mr9874616igc.18.1344368989727; Tue, 07 Aug 2012 12:49:49 -0700 (PDT) Original-Received: by 10.50.45.70 with HTTP; Tue, 7 Aug 2012 12:49:49 -0700 (PDT) In-Reply-To: <87txweq4nx.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:62925 Archived-At: I'm well aware of the insanity of this patch, but trust me, it does actually work, I use a version built with this patch every day. The reason for the weirdness is the partial use of Unicode APIs, this lead to lots of weirdness with wide strings being interpreted as single byte strings in various places. But it doesn't matter anymore, Eli's modifications removes all of the ugliness and work fine. On 7 August 2012 14:15, Jason Rumney wrote: > Joakim H=E5rsman 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 t= o >>> + retain compatibility with Windows 95. */ >>> + >>> +static void >>> +w32_set_frame_text (HWND hwnd, LPCSTR text) >>> +{ >>> + if (os_subtype =3D=3D 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 =3D ENCODE_SYSTEM (name); >>> - >>> + name =3D 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 u= sing > this patch. > >