help-gnu-emacs
[Top][All Lists]
Advanced

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

koi8 and cp1251 in RMAIL


From: Alexandru Cardaniuc
Subject: koi8 and cp1251 in RMAIL
Date: Tue, 02 Nov 2004 07:05:52 +0300

Hi All!

I am trying to customize emacs. In particular coding systems. I want
to make koi8 (or koi8-r) my default coding system both for encoding
and decoding files and messages.

But I have a problem: I am using RMAIL for reading e-mail. By default
my messages are encoded with koi8. Most messages that I get are also
in koi8, so I don't have problem reading them. But sometimes I get
messages encoded in cp1251. And RMAIL doesn't decode it correctly. It
decodes it using koi8, so that the messages are unreadable. Of course,
I can run on the message the function rmail-redecode-body with
argument cp1251. After that the message is decoded in cp1251 and I can
read it. So the question is: can I make RMAIL choose the correct
coding scheme automatically when decoding messages? 

I read the manual. And found about the priority list:
"...    However, you can alter the priority list in detail with the command
`M-x prefer-coding-system'.  This command reads the name of a coding
system from the minibuffer, and adds it to the front of the priority
list, so that it is preferred to all others.  If you use this command
several times, each use adds one element to the front of the priority
list."

But when I use this command several times, only the last command is active.
So if I do:
(prefer-coding-system 'cp1251)
(prefer-coding-system 'cyrillic-koi8)
only koi8 appears on the list - and cp1251 are not decoded correctly


Using Emacs 21.3 for Windows


that's part of my my .emacs file

-------------------------
;; setting coding systems

 (defvar cp866-decode-table
   [
  255 240 nil nil 242 nil nil 244 nil nil nil nil nil nil 246 nil
  128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
  144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
  160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
  224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239
  252 241 nil nil 243 nil nil 245 nil nil nil nil nil nil 247 nil]
   "Table for converting ISO-8859-5 characters into codepage 866 glyphs.")
 (setplist 'cp866-decode-table
      '(charset cyrillic-iso8859-5 language "Cyrillic-ISO" offset 160))
(codepage-setup 866) ;; Russian DOS

(codepage-setup 1251)

(define-coding-system-alias 'windows-1251 'cp1251)
(define-coding-system-alias 'microsoft-1251 'cp1251)
(define-coding-system-alias 'microsoft-cp1251 'cp1251)
(define-coding-system-alias 'windows-cp1251 'cp1251)
(define-coding-system-alias 'win-1251 'cp1251)
(define-coding-system-alias 'win-cp1251 'cp1251)
(define-coding-system-alias 'koi8-u 'cyrillic-koi8)
(define-coding-system-alias 'KOI8-R 'cyrillic-koi8)
(define-coding-system-alias 'koi8 'cyrillic-koi8)

;; selecting language environment
(set-language-environment 'Cyrillic-KOI8)

;(prefer-coding-system 'cyrillic-koi8)

(standard-display-8bit 128 255)

(setq default-buffer-file-coding-system 'koi8-r)
(set-terminal-coding-system 'koi8-r)
(set-keyboard-coding-system 'koi8-r)
(setq-default coding-system-for-read 'koi8-r)
(setq-default coding-system-for-write 'koi8-r)
(setq selection-coding-system 'koi8-r)
(setq default-process-coding-system 'koi8-r)
(put-charset-property 'cyrillic-iso8859-5 'preferred-coding-system 'koi8-r)
(set-input-mode nil nil 'We-will-use-eighth-bit-of-input-byte)

;; Create Cyrillic-CP1251 Language Environment menu item
(set-language-info-alist
 "Cyrillic-CP1251" `((charset cyrillic-iso8859-5)
                   (coding-system cp1251)
                   (coding-priority cp1251)
                   (input-method . "cyrillic-jcuken")
                   (features cyril-util)
                   (unibyte-display . cp1251)
                   (sample-text . "Russian (Ðóññêèé)    Çäðàâñòâóéòå!")
                   (documentation . "Support for Cyrillic CP1251."))
 '("Cyrillic"))
-------------------------



-- 
Sincerely yours,
Alexandru Cardaniuc





reply via email to

[Prev in Thread] Current Thread [Next in Thread]