Subject: bug#17909: 24.4.50; #'read-char fails with non-ASCII characters on the TTY

From: Aidan Kehoe <[email-masked]>
Date: Thu, 3 Jul 2014 15:52:29 +0100

Hello --

Starting from the shell:

$ cd /Sources/emacs/src
$ ./emacs -nw -Q RET

Then, within *scratch*, I type ƒ or ä, both of which are available on my OS
keyboard layout, and both of which self-insert without problems in the same
GNU Emacs. I then type:

(string (read-char)) <control-j> ä

This gives:

"Ã"

I note that the first octet of the UTF-8 encoding of ä corresponds to
this, as we see with, e.g.:

(decode-coding-string (encode-coding-string "ä" 'utf-8) 'iso-8859-1)
=> "Ã¤"

This bug means, among other things, that I can't name a register ä on
the TTY. The same recipe works correctly when the same binary is started as
a Cocoa app, e.g. with open /Sources/emacs/nextstep/Emacs.app .

Best,

Aidan

In GNU Emacs 24.4.50.1 (i386-apple-darwin10.8.0, NS appkit-1038.36 Version 10.6.8 (Build 10K549))
 of 2014-07-03 on bonbon
Configured using:
 `configure --with-ns'

Configured features:
RSVG IMAGEMAGICK DBUS ACL GNUTLS LIBXML2 ZLIB

Important settings:
  value of $LANG: de_DE.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t

Recent input:
ESC [ ? 1 ; 2 c ESC x r e p o r t - e m a c s - b u 
g RET

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message dired format-spec
rfc822 mml easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse
rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045
ietf-drums mm-util help-fns mail-prsvr mail-utils xterm time-date
tooltip electric uniquify ediff-hook vc-hooks lisp-float-type mwheel
ns-win tool-bar dnd fontset image regexp-opt fringe tabulated-list
newcomment lisp-mode prog-mode register page menu-bar rfn-eshadow timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai
tai-viet lao korean japanese hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help
simple abbrev minibuffer nadvice loaddefs button faces cus-face macroexp
files text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process
dbusbind cocoa ns multi-tty emacs)

Memory information:
((conses 8 81518 6143)
 (symbols 24 17883 0)
 (miscs 20 32 176)
 (strings 16 11312 3556)
 (string-bytes 1 289486)
 (vectors 8 7574)
 (vector-slots 4 346198 1936)
 (floats 8 64 283)
 (intervals 28 258 201)
 (buffers 512 12))

-- 
‘Liston operated so fast that he once accidentally amputated an assistant’s 
fingers along with a patient’s leg, […] The patient and the assistant both 
died of sepsis, and a spectator reportedly died of shock, resulting in the 
only known procedure with a 300% mortality.’ (Atul Gawande, NEJM, 2012)