Togan Muftuoglu
* Mike Fabian;
on 14 May, 2002 wrote: Togan Muftuoglu
writes:
[...]
Just one more suggestion for a workaround if you want to continue GNU Emacs and don't want to upgrade to a CVS version:
So I should not expect a newer version of Emacs which fixes my problem from SUSE in the short term. With Emacs I would not take a risk of working with self compiled CVS version as this is my work machine.
[...]
With the Xemacs. I have tried your tip (when (string-match "UTF-8" (shell-command-to-string "locale charmap")) (set-default-coding-systems 'utf-8))
I can type the with no problem I can even save it in utf-8. When I reopen the file I saved I have the Turkish characters in raw format how do I fix this ? In Emacs this does not happen.
You can replace the above lisp code in your ~/.xemacs/init.el by
(when (string-match "UTF-8" (shell-command-to-string "locale charmap"))
(setq buffer-file-coding-system-for-read 'utf-8)
(set-default-coding-systems 'utf-8))
i.e. also set the variable 'buffer-file-coding-system-for-read' to
'utf-8'. The default for this variable is 'undecided':
`buffer-file-coding-system-for-read' is a variable declared in Lisp.
-- loaded from "/usr/share/xemacs/21.4.6/lisp/code-files.elc"
Value: undecided
Documentation:
Coding system used when reading a file.
This provides coarse-grained control; for finer-grained control, use
`file-coding-system-alist'. From a Lisp program, if you wish to
unilaterally specify the coding system used for one particular
operation, you should bind the variable `coding-system-for-read'
rather than setting this variable, which is intended to be used for
global environment specification.
'undecided' means that XEmacs will try to autodetect the coding
system. It looks like GNU Emacs is better than XEmacs in autodetecting
UTF-8 encoded files.
You also add a 'coding system cookie' to the first line of your file.
Looks like this:
-*- coding: utf-8 -*-
It can be anywhere on the first line of the file. This will override
the value of buffer-file-coding-system-for-read.
You can also specify the encoding manually when reading a file:
C-x RET c utf-8 RET C-x C-f filename RET
This works for both Emacs and XEmacs. For XEmacs you also
have the shortcut:
C-u C-x C-f filename RET utf-8 RET
--
Mike Fabian