emacs-devel
[Top][All Lists]

## Re: Coding systems and Terminal.app on Mac OS X

 From: Peter Dyballa Subject: Re: Coding systems and Terminal.app on Mac OS X Date: Fri, 25 Mar 2005 00:34:55 +0100

Hello!


Terminal.app is a complicated application and clearly not finished (with ls in Terminal I can't see UTF-8 file names correctly, only a??o??u????U??O??A?????, doing it in Emacs' shell I see a\314?o\314?u\314?\303?U\314?O\314?A\314?\342?\254 and in dired as the correct string äöüßÜÖÄ€ as in Finder too).


Maybe we should try to adjust our settings. I have in Terminal's «Window Preferences»

in *Emulation* set
Option+Click to position cursor in command line
(non-ASCII -> Esc is not active/checked)

in *Monitor* set

Lucida Sans Typewriter Regular (a font from the Java Runtime Environment)
anti-aliasing
Copy&Paste with moving/dragging
UTF-8 encoding

in *Keyboard* /not/ set
alt/Option/⌥ as Meta//Command/⌘

Am 24.03.2005 um 18:17 schrieb Stefan:


TERM_PROGRAM=Apple_Terminal
TERM_PROGRAM_VERSION=100.1.4


Now, the next problem is keyboard input: my meta key doesn't work in
Terminal.app



That is true for GNU Emacs as X11 client, running in xterm, or running in Terminal. Only Carbon Emacs understand Cmd-x/Apple-x/⌘-x as M-x.


 and neither do accented chars.  Looking at C-h l I see that the

byte sequence that Emacs receives is odd. E.g. for "M-x" Emacs receives (I
use the "meta-is-bit7" convention):

C-v \342 C-v \211 C-v \210

Assuming the C-v was meant to be some kind of quoting char (as it is in

several Unix tools where it plays the same role as Emacs's C-q), we could think of it as "\342 \211 \210", which is a valid utf-8 sequence for "≈". After trying to insert some accented chars, it seems that indeed the input is a kind of "utf-8 interleaved with C-v" and my meta key sends non-ASCII chars instead of something like an ESC prefix. Does anybody know what this
C-v stuff is about?



I actually don't know what Terminal or Apple or both are trying with this and what it's good for (maybe it's necessary for vi/vim), but with the above mentioned settings I can directly input with my German keyboard these seven umlauts and some more with Character Palette utility and Emacs itself writes the month of March as "März" as I set it in calendar-month-name-array and in calendar-month-abbrev-array:






PS: Actually, the utf-8 display doesn't work 100% because Terminal.app

displays my \lambda characters as two-columns-chars and Emacs doesn't know about it, so the display gets confused and every once in a while a bit of
C-l is needed.



Again this comes from your settings. And there is another problem: since Terminal or xterm have only one font available you could miss some characters from this. The HELLO buffer shows in Terminal twice this:

Greek (ελληνικά)                Γειά σας


because they're Lucida Sans Typewriter -- and it shows some extra scripts that GNU Emacs puts there: Amharic, Braille, Georgian, Lao, Tibetan, Tigrina, half Japanese. Hebrew, Thai, and Cyrillic are in the font too and visible, but not Arabic! It's right-to-left as Hebrew. (In xterm it looks worse: many hollow boxes and even more U+FEFF, a black square on one edge with a white question mark as in my screenshot.)


If you can't find the Character Palette, here is way to make it available: in System Preferences go to Locale (the UN flag), choose Keyboard Menu and click there 'Keyboard Menu in Menubar' plus choose from the window with the flags those keyboard layouts that you might like to use *and* Character Palette, Keyboard Layout. Now you can choose from the Menubar the 'Canadian Flag' menu which will have the Character Palette. Cmd-clicking you can drag/position a menu in the Menubar.


Have you tried to correct on Terminal's command line mis-spellings? C-d, C-t, C-w, Esc-BS ... work.

--
Greetings

Pete