[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

xterm, mutt, emacs -nw, and utf-8



I'm in the process of converting to utf-8 locales and have some
problems with emacs -nw in a xterm, and a related question about mutt.

In general it is quite simple to convert, (re)configure locales to set
some utf-8 locale as default. In particular for etch and sid (I use
both, and some computers at work have sarge).

EMACS

After some additional configuration of emacs (some variables in
.emacs, se below) I also get emacs under X to work nicely and being
able to edit and save files in the appropriate formats.

After opening a utf-8 encoded file, describe coding system (C-h C)
produces the output in [2] below.

XTERM

Xterm by itself also seems to be able, and if I set the use of fonts
in .Xdefaults by e.g.

XTerm*font: -misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso10646-1

it can print most characters. For example the results of echo -e
"'\303\204\304\211\320\257'". (All shamelessly stolen from pages found
with google.)

EMACS IN XTERM

Now the problem is emacs in a terminal window. It does properly show
utf-8 characters when I open documents. But when I start to write it
does not correctly understand the Swedish characters from my keyboard,
which indicates some problem with keyboard setting or input or so.

After opening a utf-8 encoded file with emacs -nw, C-h C produces the
output in [3].

Any tips or solutions to get utf-8 working for emacs -nw in xterm?


MUTT

A related issue is mutt, which I use both on sid and sarge, and it
starts emacs in the xterm where it runs. In sarge (with utf-8 as
default) the settings for emacs are seen in [4].  But on sid mutt
starts emacs differently, see [5].

I don't understand where the differences come from as my .emacs are
identical for the two computers, and there seems to be no significant
differences in the site wide emacs settings.

BTW, is it really necessary to use the package mutt-utf8 to get
support for utf-8? It seems to work and the characters show up nicely
in normal mutt. I think it my(?) configuration of emacs in a terminal
window that is the root cause of these problem.

Anders

------------------

Here goes all details.

[1] .emacs (relevant parts):

(custom-set-variables
  ;; custom-set-variables was added by Custom -- don't edit or cut/paste it!                                                                   
  ;; Your init file should contain only one such instance.                                                                                     
 '(case-fold-search t)
 '(column-number-mode t)
 '(current-language-environment "UTF-8")
 '(default-input-method "rfc1345")
 '(set-keyboard-coding-system nil)
 '(global-font-lock-mode t nil (font-lock))
 '(menu-bar-mode t)
 '(mouse-wheel-mode t nil (mwheel))
 '(show-paren-mode t nil (paren))
 '(tool-bar-mode nil nil (tool-bar)))
;; (standard-display-european t)                                                                                                               

(setq read-quoted-char-radix 10)


[2] C-h C on emacs in X11 window

Coding system for saving this buffer:
  u -- mule-utf-8-unix
Default coding system (for new files):
  u -- mule-utf-8 (alias: utf-8)
Coding system for keyboard input:
  nil
Coding system for terminal output:
  u -- mule-utf-8 (alias: utf-8)
Defaults for subprocess I/O:
  decoding: u -- mule-utf-8 (alias: utf-8)
  encoding: u -- mule-utf-8 (alias: utf-8)

Priority order for recognizing coding systems when reading files:
  1. mule-utf-8 (alias: utf-8)
  2. iso-latin-1 (alias: iso-8859-1 latin-1)
  3. iso-2022-jp (alias: junet)
  4. iso-2022-7bit 
  5. iso-2022-7bit-lock (alias: iso-2022-int-1)
  6. iso-2022-8bit-ss2 
  7. emacs-mule 
  8. raw-text 
  9. japanese-shift-jis (alias: shift_jis sjis)
  10. chinese-big5 (alias: big5 cn-big5)
  11. no-conversion (alias: binary)



[3] C-h C on opening a utf-8 encoded file with emacs -nw in a utf-8 aware xterm

Coding system for saving this buffer:
  u -- mule-utf-8-unix
Default coding system (for new files):
  u -- mule-utf-8 (alias: utf-8)
Coding system for keyboard input:
  nil
Coding system for terminal output:
  u -- mule-utf-8 (alias: utf-8)
Defaults for subprocess I/O:
  decoding: u -- mule-utf-8 (alias: utf-8)
  encoding: u -- mule-utf-8 (alias: utf-8)



[4] emacs started in xterm mutt under sarge, C-h C gives:

Coding system for saving this buffer:
  1 -- iso-latin-1-unix
Default coding system (for new files):
  u -- mule-utf-8 (alias: utf-8)
Coding system for keyboard input:
  nil
Coding system for terminal output:
  u -- mule-utf-8 (alias: utf-8)
Defaults for subprocess I/O:
  decoding: u -- mule-utf-8 (alias: utf-8)
  encoding: u -- mule-utf-8 (alias: utf-8)


[5] emacs started in xterm by mutt under sid, C-h C gives:

Coding system for saving this buffer:
  u -- mule-utf-8 (alias: utf-8)
Default coding system (for new files):
  u -- mule-utf-8 (alias: utf-8)
Coding system for keyboard input:
  nil
Coding system for terminal output:
  u -- mule-utf-8 (alias: utf-8)
Defaults for subprocess I/O:
  decoding: u -- mule-utf-8 (alias: utf-8)
  encoding: u -- mule-utf-8 (alias: utf-8)



Reply to: