Eli Zaretskii | 30 Jul 2012 16:32
Picon

bug#12082: 24.1.50; Wrong character showed by "C-h c"

> From: Juanma Barranquero <lekktu <at> gmail.com>
> Date: Mon, 30 Jul 2012 13:47:44 +0200
> 
> On Mon, Jul 30, 2012 at 5:37 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:
> 
> > Interesting.  How did you two type M-ç?  And what are your values of
> > keyboard and terminal coding-systems, and also what does
> > w32-get-console-codepage return?
> 
> Ah, now I see a difference. Interesting, yes.
> 
> I did the last check from a TCC console, not CMD, the difference being
> that in TCC I set the codepage to 1252, while CMD uses 850.
> 
> So yes, starting emacs from CMD in window mode, C-h c M-ç indeed
> produces the ‡ message.
> 
> I type M-ç with the left Alt key and the ç key of the Spanish keyboard.
> 
> So, to summarize:
> 
> - In CMD, with active codepage = 437
>   - Window mode:
>     keyboard-coding-system = windows-1252-unix
>     (terminal-coding-system) =  cp1252
>     (w32-get-console-codepage) = 437
>     Messages: "M-‡ is undefined"
> 
>   - Non-window mode:
>     keyboard-coding-system = cp437-unix
(Continue reading)

Juanma Barranquero | 30 Jul 2012 16:49
Picon
Gravatar

bug#12082: 24.1.50; Wrong character showed by "C-h c"

On Mon, Jul 30, 2012 at 4:32 PM, Eli Zaretskii <eliz <at> gnu.org> wrote:

>   . switch the keyboard to English ("EN" near the system tray), if you
>     can, and type a couple of pure ASCII characters

- With english keyboard

a
warning: w32fns: WM_CHAR 0x61
warning: w32term: 0x61 => 0x61 (cp1252)

$
warning: w32fns: WM_CHAR 0x24
warning: w32term: 0x24 => 0x24 (cp1252)

;
warning: w32fns: WM_CHAR 0x3b
warning: w32term: 0x3b => 0x3b (cp1252)

>   . switch the keyboard to Spanish and type ç and M-ç

- With spanish keyboard, cp 850:

ç
warning: w32fns: WM_CHAR 0xe7
warning: w32term: 0xffffffe7 => 0xe7 (cp1252)

M-ç
warning: w32term: 0xffffff87 => 0x2021 (cp1252)

(Continue reading)

Dani Moncayo | 30 Jul 2012 16:53
Picon

bug#12082: 24.1.50; Wrong character showed by "C-h c"

> Looks like Windows lies to us about the input codepage.  Please apply
> the patches below, run Emacs in GUI mode under GDB, and do the
> following experiments:
>
>   . switch the keyboard to English ("EN" near the system tray), if you
>     can, and type a couple of pure ASCII characters

[a]
warning: w32fns: WM_CHAR 0x61
warning: w32term: 0x61 => 0x61 (cp1252)

[z]
warning: w32fns: WM_CHAR 0x7a
warning: w32term: 0x7a => 0x7a (cp1252)

>   . switch the keyboard to Spanish and type ç and M-ç

[ç]
warning: w32fns: WM_CHAR 0xe7
warning: w32term: 0xffffffe7 => 0xe7 (cp1252)

[M-ç]
warning: w32term: 0xffffff87 => 0x2021 (cp1252)

(yes, only one message for this character)

>   . do the latter both with active codepage 850 and 1252

?? Where can I set the "active codepage"? Please elaborate this step a bit more.

(Continue reading)

Juanma Barranquero | 30 Jul 2012 16:56
Picon
Gravatar

bug#12082: 24.1.50; Wrong character showed by "C-h c"

On Mon, Jul 30, 2012 at 4:53 PM, Dani Moncayo <dmoncayo <at> gmail.com> wrote:

> ?? Where can I set the "active codepage"? Please elaborate this step a bit more.

Use the chcp command in the CMD session before running gdb / emacs.

    Juanma

Dani Moncayo | 30 Jul 2012 17:05
Picon

bug#12082: 24.1.50; Wrong character showed by "C-h c"

>>   . switch the keyboard to English ("EN" near the system tray), if you
>>     can, and type a couple of pure ASCII characters
>
> [a]
> warning: w32fns: WM_CHAR 0x61
> warning: w32term: 0x61 => 0x61 (cp1252)
>
> [z]
> warning: w32fns: WM_CHAR 0x7a
> warning: w32term: 0x7a => 0x7a (cp1252)
>
>>   . switch the keyboard to Spanish and type ç and M-ç
>
> [ç]
> warning: w32fns: WM_CHAR 0xe7
> warning: w32term: 0xffffffe7 => 0xe7 (cp1252)
>
> [M-ç]
> warning: w32term: 0xffffff87 => 0x2021 (cp1252)
>
> (yes, only one message for this character)
>
>>   . do the latter both with active codepage 850 and 1252

(Thanks Juanma)

All the above was with codepage 850.  Now if I set the codepage to
1252 (in the cmd sessions from where I invoke gdb and Emacs), I see:

[ç]
(Continue reading)

Eli Zaretskii | 30 Jul 2012 17:58
Picon

bug#12082: 24.1.50; Wrong character showed by "C-h c"

> Date: Mon, 30 Jul 2012 17:05:01 +0200
> From: Dani Moncayo <dmoncayo <at> gmail.com>
> Cc: Juanma Barranquero <lekktu <at> gmail.com>, 12082 <at> debbugs.gnu.org
> 
> >>   . switch the keyboard to English ("EN" near the system tray), if you
> >>     can, and type a couple of pure ASCII characters
> >
> > [a]
> > warning: w32fns: WM_CHAR 0x61
> > warning: w32term: 0x61 => 0x61 (cp1252)
> >
> > [z]
> > warning: w32fns: WM_CHAR 0x7a
> > warning: w32term: 0x7a => 0x7a (cp1252)
> >
> >>   . switch the keyboard to Spanish and type ç and M-ç
> >
> > [ç]
> > warning: w32fns: WM_CHAR 0xe7
> > warning: w32term: 0xffffffe7 => 0xe7 (cp1252)
> >
> > [M-ç]
> > warning: w32term: 0xffffff87 => 0x2021 (cp1252)
> >
> > (yes, only one message for this character)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This means M-ç gets processed by some code in w32fns.c that doesn't
have a DebPrint.  Can you find out which one (by sticking DebPrint)?
For example, these two fragments look as possible suspects:

(Continue reading)

Dani Moncayo | 30 Jul 2012 18:16
Picon

bug#12082: 24.1.50; Wrong character showed by "C-h c"

>> > [M-ç]
>> > warning: w32term: 0xffffff87 => 0x2021 (cp1252)
>> >
>> > (yes, only one message for this character)
>           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> This means M-ç gets processed by some code in w32fns.c that doesn't
> have a DebPrint.  Can you find out which one (by sticking DebPrint)?
> For example, these two fragments look as possible suspects:
>
> 1)
>         default:

In this line, I inserted this: DebPrint (("w32fns: #1-default 0x%x\n", wParam));

>           /* If not defined as a function key, change it to a WM_CHAR message. */
>           if (wParam > 255 || !lispy_function_keys[wParam])

And I've seen that the execution arrives to this first case.  This is
the output from gdb:

  warning: w32fns: #1-default 0xbf
  warning: w32term: 0xffffff87 => 0x2021 (cp1252)

--

-- 
Dani Moncayo

Eli Zaretskii | 30 Jul 2012 18:43
Picon

bug#12082: 24.1.50; Wrong character showed by "C-h c"

> Date: Mon, 30 Jul 2012 18:16:08 +0200
> From: Dani Moncayo <dmoncayo <at> gmail.com>
> Cc: lekktu <at> gmail.com, 12082 <at> debbugs.gnu.org
> 
> >> > [M-ç]
> >> > warning: w32term: 0xffffff87 => 0x2021 (cp1252)
> >> >
> >> > (yes, only one message for this character)
> >           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > This means M-ç gets processed by some code in w32fns.c that doesn't
> > have a DebPrint.  Can you find out which one (by sticking DebPrint)?
> > For example, these two fragments look as possible suspects:
> >
> > 1)
> >         default:
> 
> In this line, I inserted this: DebPrint (("w32fns: #1-default 0x%x\n", wParam));
> 
> >           /* If not defined as a function key, change it to a WM_CHAR message. */
> >           if (wParam > 255 || !lispy_function_keys[wParam])
> 
> 
> And I've seen that the execution arrives to this first case.  This is
> the output from gdb:
> 
>   warning: w32fns: #1-default 0xbf
>   warning: w32term: 0xffffff87 => 0x2021 (cp1252)

Heh, everything is clear now.  Stay tuned for a solution.

(Continue reading)

Eli Zaretskii | 30 Jul 2012 19:16
Picon

bug#12082: 24.1.50; Wrong character showed by "C-h c"

> Date: Mon, 30 Jul 2012 19:43:08 +0300
> From: Eli Zaretskii <eliz <at> gnu.org>
> Cc: lekktu <at> gmail.com, 12082 <at> debbugs.gnu.org
> 
> > Date: Mon, 30 Jul 2012 18:16:08 +0200
> > From: Dani Moncayo <dmoncayo <at> gmail.com>
> > Cc: lekktu <at> gmail.com, 12082 <at> debbugs.gnu.org
> > 
> > >> > [M-ç]
> > >> > warning: w32term: 0xffffff87 => 0x2021 (cp1252)
> > >> >
> > >> > (yes, only one message for this character)
> > >           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > > This means M-ç gets processed by some code in w32fns.c that doesn't
> > > have a DebPrint.  Can you find out which one (by sticking DebPrint)?
> > > For example, these two fragments look as possible suspects:
> > >
> > > 1)
> > >         default:
> > 
> > In this line, I inserted this: DebPrint (("w32fns: #1-default 0x%x\n", wParam));
> > 
> > >           /* If not defined as a function key, change it to a WM_CHAR message. */
> > >           if (wParam > 255 || !lispy_function_keys[wParam])
> > 
> > 
> > And I've seen that the execution arrives to this first case.  This is
> > the output from gdb:
> > 
> >   warning: w32fns: #1-default 0xbf
(Continue reading)

Dani Moncayo | 30 Jul 2012 19:47
Picon

bug#12082: 24.1.50; Wrong character showed by "C-h c"

> Should be fixed in trunk revision 109300.  Please test.

Thank you so much.

The GUI session now seems to work like a charm.

The TTY session also works well for all the tests I've done so far,
but I've found another use case that seems an error: from "emacs -Q
-nw", if I type "C-h c C-ç", I get the message "C-\ runs the command
toggle-input-method".

FWIW, here are some values from the TTY session:
  (terminal-coding-system) => cp850
  (keyboard-coding-system) => cp850-unix
  w32-ansi-code-page => 1252
  (w32-get-console-codepage) => 850
  (w32-get-console-output-codepage) => 850

and when I exit emacs, the chcp command says "Active code page: 850".

--

-- 
Dani Moncayo

Eli Zaretskii | 30 Jul 2012 20:11
Picon

bug#12082: 24.1.50; Wrong character showed by "C-h c"

> Date: Mon, 30 Jul 2012 19:47:33 +0200
> From: Dani Moncayo <dmoncayo <at> gmail.com>
> Cc: lekktu <at> gmail.com, 12082 <at> debbugs.gnu.org
> 
> The TTY session also works well for all the tests I've done so far,
> but I've found another use case that seems an error: from "emacs -Q
> -nw", if I type "C-h c C-ç", I get the message "C-\ runs the command
> toggle-input-method".

That's probably a limitation of console input.  What happens if you
type C-ç alone, without "C-h c"?


Gmane