Subject: Re: bug#14403: 24.3.50; [regression] Typing non-ascii characters on a non-GUI MS-Windows session

From: Eli Zaretskii <[email-masked]>
Date: Wed, 15 May 2013 11:13:03 +0300

> From: Stefan Monnier <[email-masked]>
> Cc: [email-masked],  [email-masked]
> Date: Tue, 14 May 2013 18:28:35 -0400
> 
> > This is an exact duplicate of 14368, discussed just yesterday.
> 
> Hmm, this looks different, since it doesn't seem to use quail

Different, yes.  But caused by the same change in keyboard.c.

> Is it the case that the non-GUI code in Windows receives decoded
> chars in `read_char', contrary to the posix code which receives
> encoded chars there?

Both GUI and non-GUI keyboard input on Windows produce Unicode
codepoints of the characters the user types.  The produced input
events have the 'kind' of either ASCII_KEYSTROKE_EVENT or
MULTIBYTE_CHAR_KEYSTROKE_EVENT.  They are returned via this call
sequence:

  read_char -> kbd_buffer_get_event -> make_lispy_event

I guess the solution is to tell read_decoded_char more about the event
that produced the character?

Or maybe we should not set the keyboard encoding to the console
codepage on Windows (although I have no idea what kind of breakage
this could cause)?  What setting of keyboard-coding-system tells the
condition below that no decoding is needed?

Of course, we could always augment this condition:

      if (!((FRAME_TERMCAP_P (frame) || FRAME_MSDOS_P (frame))
	    && (TERMINAL_KEYBOARD_CODING (terminal)->common_flags
		& CODING_REQUIRE_DECODING_MASK)))
	return nextevt;		/* No decoding needed.  */

to do something special for MS-Windows, but that sounds kludgey.