Subject: Re: bug#12055: 24.1.50; Characters "á" and "é"are not correctly displayed on a Windows terminal

From: Eli Zaretskii <[email-masked]>
Date: Fri, 27 Jul 2012 18:12:18 +0300

> Date: Fri, 27 Jul 2012 12:04:57 +0300
> From: Eli Zaretskii <[email-masked]>
> Cc: [email-masked], [email-masked]
> 
> > Date: Fri, 27 Jul 2012 10:35:53 +0200
> > From: Dani Moncayo <[email-masked]>
> > Cc: [email-masked], [email-masked]
> > 
> > > Please try that in the non-GUI session where you first set the
> > > terminal coding-system to cp850.
> > 
> > Ok.  If I do:
> > 1. emacs -nw -Q
> > 2. C-x RET t cp850 RET
> > 3. Visit the test file.
> > 
> > Then the file is corrrectly displayed.
> 
> Thanks.  If no one beats me to it, I will look into the input issue
> when I have time.

Well, I see some strange stuff in the input processing.

Please add this snippet:

  DebPrint (("key_event: %d %d 0x%x 0x%x {0x%x 0x%x} 0x%x\n",
	     event->bKeyDown, event->wRepeatCount,
	     event->wVirtualKeyCode, event->wVirtualScanCode,
	     event->uChar.AsciiChar, event->uChar.UnicodeChar,
	     event->dwControlKeyState));

at the very beginning of key_event function (in w32inevt.c), attach
GDB to a running "emacs -Q -nw", and tell me what does GDB report when
you type non-ASCII keys on your keyboard.

That is,

  emacs -Q -nw
  gdb -p EMACS-PID
  (gdb) continue

then type non-ASCII characters into Emacs.  You should see messages
such as these:

  warning: key_event: 0 1 0x54 0x14 {0xffffff80 0x580} 0x20

  warning: key_event: 1 1 0x54 0x14 {0xffffff80 0x580} 0x20

(but with different codes).  There are 2 messages for each keystroke:
one when the key is pressed, the other when it is released.  Please
post here the exact output, and please tell for each pair of such
messages which character did you type.