1 ;;; cyrillic.el --- support for Cyrillic -*- coding: iso-2022-7bit; -*-
3 ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN.
4 ;; Licensed to the Free Software Foundation.
5 ;; Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
7 ;; Author: Kenichi Handa <handa@etl.go.jp>
8 ;; Keywords: multilingual, Cyrillic, i18n
10 ;; This file is part of GNU Emacs.
12 ;; GNU Emacs is free software; you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation; either version 2, or (at your option)
17 ;; GNU Emacs is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
25 ;; Boston, MA 02111-1307, USA.
29 ;; The character set ISO8859-5 is supported. KOI-8 and ALTERNATIVNYJ
30 ;; are converted to Unicode internally. See
31 ;; <URL:http://www.ecma.ch/ecma1/STAND/ECMA-113.HTM>. For more info
32 ;; on Cyrillic charsets, see
33 ;; <URL:http://czyborra.com/charsets/cyrillic.html>. The KOI and
34 ;; Alternativnyj coding systems should live in code-pages.el, but
35 ;; they've always been preloaded and the coding system autoload
36 ;; mechanism didn't get accepted, so they have to stay here and
37 ;; duplicate code-pages stuff.
39 ;; Note that 8859-5 maps directly onto the Unicode Cyrillic block,
40 ;; apart from codepoints 160 (NBSP, c.f. U+0400), 173 (soft hyphen,
41 ;; c.f. U+04OD) and 253 (section sign, c.f U+045D). The KOI-8 and
42 ;; Alternativnyj coding systems encode both 8859-5 and Unicode.
43 ;; ucs-tables.el provides unification for cyrillic-iso-8bit.
45 ;; Customizing `utf-fragment-on-decoding' allows decoding characters
46 ;; from KOI and Alternativnyj into 8859-5 where that's possible.
47 ;; cyrillic-iso8859-5 characters take half as much space in the buffer
48 ;; as the mule-unicode-0100-24ff equivalents, though that's probably
49 ;; not normally a big deal.
58 'cyrillic-iso-8bit
2 ?
5
59 "ISO 2022 based 8-bit encoding for Cyrillic script (MIME:ISO-8859-5)."
60 '(ascii cyrillic-iso8859-5 nil nil
61 nil nil nil nil nil nil nil nil nil nil nil t
)
62 '((safe-charsets ascii cyrillic-iso8859-5
)
63 (mime-charset . iso-8859-5
)))
65 (define-coding-system-alias 'iso-8859-5
'cyrillic-iso-8bit
)
67 (set-language-info-alist
68 "Cyrillic-ISO" '((charset cyrillic-iso8859-5
)
69 (coding-system cyrillic-iso-8bit
)
70 (coding-priority cyrillic-iso-8bit
)
71 (input-method .
"cyrillic-yawerty") ; fixme
72 (nonascii-translation . cyrillic-iso8859-5
)
73 (unibyte-display . cyrillic-iso-8bit
)
75 (sample-text .
"Russian (\e,L@caaZXY\e(B) \e,L7T`PRabRcYbU\e(B!")
76 (documentation .
"Support for Cyrillic ISO-8859-5."))
81 ;; The mule-unicode portion of this is from
82 ;; http://www.unicode.org/Public/MAPPINGS/VENDORS/MISC/KOI8-R.TXT,
83 ;; which references RFC 1489.
84 (defvar cyrillic-koi8-r-decode-table
86 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
87 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
88 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
89 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
90 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
91 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
92 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
93 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
94 ;; 8859-5 plus Unicode
95 ?
\e$
,2 \e(B ?
\e$
,2 "\e(B ?\e$,2 ,\e(B ?\e$,2 0\e(B ?\e$,2 4\e(B ?\e$,2 8\e(B ?\e$,2 <\e(B ?\e$,2 D\e(B ?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,1(?\e(B ?\e$,1(O\e(B ?\e$,1(@\e(B ?\e$,1(A\e(B ?\e$,1(B\e(B ?\e$,1(C\e(B ?\e$,1(6\e(B ?\e$,1(2\e(B ?\e$,1(L\e(B ?\e$,1(K\e(B ?\e$,1(7\e(B ?\e$,1(H\e(B ?\e$,1(M\e(B ?\e$,1(I\e(B ?\e$,1(G\e(B ?\e$,1(J\e(B
113 "Cyrillic KOI8-R decoding table.")
115 (let ((table (make-translation-table-from-vector
116 cyrillic-koi8-r-decode-table
)))
117 (define-translation-table 'cyrillic-koi8-r-nonascii-translation-table table
)
118 (define-translation-table 'cyrillic-koi8-r-encode-table
119 (char-table-extra-slot table
0)))
121 ;; No point in keeping it around. (It can't be let-bound, since it's
122 ;; needed for macro expansion.)
123 (makunbound 'cyrillic-koi8-r-decode-table
)
125 (define-ccl-program ccl-decode-koi8
132 ((translate-character cyrillic-koi8-r-nonascii-translation-table r0 r1
)
133 (translate-character ucs-translation-table-for-decode r0 r1
)
134 (write-multibyte-character r0 r1
)
136 "CCL program to decode KOI8-R.")
138 (define-ccl-program ccl-encode-koi8
141 (read-multibyte-character r0 r1
)
142 (translate-character cyrillic-koi8-r-encode-table r0 r1
)
143 (if (r0 != ,(charset-id 'ascii
))
144 (if (r0 != ,(charset-id 'eight-bit-graphic
))
145 (if (r0 != ,(charset-id 'eight-bit-control
))
148 "CCL program to encode KOI8-R.")
150 (defun cyrillic-unify-encoding (table)
151 "Set up equivalent characters in the encoding TABLE.
152 This works whether or not the table is Unicode-based or
153 8859-5-based. (Only appropriate for Cyrillic.)"
154 (let ((table (get table
'translation-table
)))
156 (let* ((c (make-char 'cyrillic-iso8859-5
(+ i
32)))
157 (u ; equivalent Unicode char
158 (cond ((eq c ?
\e,L
\e(B) ?
\e,A
\e(B)
159 ((eq c ?
\e,L-
\e(B) ?
\e,A-
\e(B)
160 ((eq c ?
\e,L
}\e(B) ?
\e,A
'\e(B)
161 (t (decode-char 'ucs
(+ #x400 i
)))))
162 (ec (aref table c
)) ; encoding of 8859-5
163 (uc (aref table u
))) ; encoding of Unicode
164 (unless (memq c
'(?
\e,L
\e(B ?
\e,L-
\e(B ?
\e,L
}\e(B)) ; 8859-5 exceptions
168 (aset table c uc
)))))))
170 (cyrillic-unify-encoding 'cyrillic-koi8-r-encode-table
)
174 ;; We used to use ?K. It is true that ?K is more strictly correct,
175 ;; but it is also used for Korean.
176 ;; So people who use koi8 for languages other than Russian
177 ;; will have to forgive us.
178 ?R
"KOI8-R 8-bit encoding for Cyrillic (MIME: KOI8-R)."
179 '(ccl-decode-koi8 . ccl-encode-koi8
)
180 `((safe-chars . cyrillic-koi8-r-encode-table
)
181 (mime-charset . koi8-r
)
182 (valid-codes (0 .
255))
183 (dependency unify-8859-on-encoding-mode unify-8859-on-decoding-mode
)))
185 (define-coding-system-alias 'koi8-r
'cyrillic-koi8
)
186 (define-coding-system-alias 'koi8
'cyrillic-koi8
)
187 (define-coding-system-alias 'cp878
'cyrillic-koi8
)
189 (let ((elt `("koi8-r" koi8-r
1
190 ,(get 'cyrillic-koi8-r-encode-table
'translation-table
)))
191 (slot (assoc "koi8-r" ctext-non-standard-encodings-alist
)))
193 (setcdr slot
(cdr elt
))
194 (push elt ctext-non-standard-encodings-alist
)))
196 ;; Allow displaying some of KOI & al with an 8859-5-encoded font. We
197 ;; won't bother about the exceptions when encoding the font, since
198 ;; NBSP will fall through below and work anyhow, and we'll have
199 ;; avoided setting the fontset for the other two to 8859-5 -- they're
200 ;; not in KOI and Alternativnyj anyhow.
201 (define-ccl-program ccl-encode-8859-5-font
203 ((if (r0 == ,(charset-id 'cyrillic-iso8859-5
))
205 (if (r0 == ,(charset-id 'mule-unicode-0100-24ff
))
206 (r1 = (r2 + 128))))))
207 "Encode ISO 8859-5 and Cyrillic Unicode chars to 8859-5 font.")
209 (add-to-list 'font-ccl-encoder-alist
'("iso8859-5" . ccl-encode-8859-5-font
))
211 ;; The table is set up later to encode both Unicode and 8859-5.
212 (define-ccl-program ccl-encode-koi8-font
217 (translate-character cyrillic-koi8-r-encode-table r0 r1
))
218 "CCL program to encode Cyrillic chars to KOI font.")
220 (add-to-list 'font-ccl-encoder-alist
'("koi8" . ccl-encode-koi8-font
))
222 (set-language-info-alist
223 "Cyrillic-KOI8" `((charset cyrillic-iso8859-5
)
224 (nonascii-translation
225 .
,(get 'cyrillic-koi8-r-nonascii-translation-table
227 (coding-system cyrillic-koi8
)
228 (coding-priority cyrillic-koi8 cyrillic-iso-8bit
)
229 (ctext-non-standard-encodings "koi8-r")
230 (input-method .
"russian-typewriter")
231 (features cyril-util
)
232 (unibyte-display . cyrillic-koi8
)
233 (sample-text .
"Russian (\e,L@caaZXY\e(B) \e,L7T`PRabRcYbU\e(B!")
234 (documentation .
"Support for Cyrillic KOI8-R."))
237 (set-language-info-alist
238 "Russian" `((charset cyrillic-iso8859-5
)
239 (nonascii-translation
240 .
,(get 'cyrillic-koi8-r-nonascii-translation-table
242 (coding-system cyrillic-koi8
)
243 (coding-priority cyrillic-koi8 cyrillic-iso-8bit
)
244 (input-method .
"russian-computer")
245 (features cyril-util
)
246 (unibyte-display . cyrillic-koi8
)
247 (sample-text .
"Russian (\e,L@caaZXY\e(B) \e,L7T`PRabRcYbU\e(B!")
249 Support for Russian using koi8-r and the russian-computer input method.")
250 (tutorial .
"TUTORIAL.ru"))
254 (defvar cyrillic-koi8-u-decode-table
256 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
257 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
258 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
259 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
260 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
261 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
262 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
263 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
265 ;; ?\e$,2 \e(B ?\e$,2 "\e(B ?\e$,2 ,\e(B ?\e$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LO\e(B ?\e,L@\e(B ?\e,LA\e(B ?\e,LB\e(B ?\e,LC\e(B ?\e,L6\e(B ?\e,L2\e(B ?\e,LL\e(B ?\e,LK\e(B ?\e,L7\e(B ?\e,LH\e(B ?\e,LM\e(B ?\e,LI\e(B ?\e,LG\e(B ?\e,LJ\e(B
283 "Cyrillic KOI8-U decoding table.
")
285 (let ((table (make-translation-table-from-vector
286 cyrillic-koi8-u-decode-table)))
287 (define-translation-table 'cyrillic-koi8-u-nonascii-translation-table table)
288 (define-translation-table 'cyrillic-koi8-u-encode-table
289 (char-table-extra-slot table 0)))
291 (makunbound 'cyrillic-koi8-u-decode-table)
293 (define-ccl-program ccl-decode-koi8-u
300 ((translate-character cyrillic-koi8-u-nonascii-translation-table r0 r1)
301 (translate-character ucs-translation-table-for-decode r0 r1)
302 (write-multibyte-character r0 r1)
304 "CCL program to decode KOI8-U.
")
306 (define-ccl-program ccl-encode-koi8-u
309 (read-multibyte-character r0 r1)
310 (translate-character cyrillic-koi8-u-encode-table r0 r1)
311 (if (r0 != ,(charset-id 'ascii))
312 (if (r0 != ,(charset-id 'eight-bit-graphic))
313 (if (r0 != ,(charset-id 'eight-bit-control))
316 "CCL program to encode KOI8-U.
")
318 (cyrillic-unify-encoding 'cyrillic-koi8-u-encode-table)
322 ?U "KOI8-U
8-bit encoding for Cyrillic
(MIME: KOI8-U
)"
323 '(ccl-decode-koi8-u . ccl-encode-koi8-u)
324 `((safe-chars . cyrillic-koi8-u-encode-table)
325 (mime-charset . koi8-u)
326 (valid-codes (0 . 255))
327 (dependency unify-8859-on-encoding-mode unify-8859-on-decoding-mode)))
329 (define-ccl-program ccl-encode-koi8-u-font
331 (translate-character cyrillic-koi8-u-encode-table r0 r1))
332 "CCL program to encode Cyrillic chars to KOI-U font.
")
334 (add-to-list 'font-ccl-encoder-alist '("koi8-u
" . ccl-encode-koi8-u-font))
336 (set-language-info-alist
337 "Ukrainian
" `((coding-system koi8-u)
338 (coding-priority koi8-u)
339 (nonascii-translation
340 . ,(get 'cyrillic-koi8-u-nonascii-translation-table
342 (input-method . "ukrainian-computer
")
344 . "Support for Ukrainian with KOI8-U character set.
"))
347 ;;; ALTERNATIVNYJ stuff
349 ;; Fixme: It's unclear what's the correct table. I've found
350 ;; statements both that it's the same as cp866 and somewhat different,
351 ;; but nothing that looks really definitive.
352 (defvar cyrillic-alternativnyj-decode-table
354 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
355 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
356 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
357 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
358 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
359 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
360 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
361 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
362 ;; ?\e$,1(0\e(B ?\e$,1(1\e(B ?\e$,1(2\e(B ?\e$,1(3\e(B ?\e$,1(4\e(B ?\e$,1(5\e(B ?\e$,1(6\e(B ?\e$,1(7\e(B ?\e$,1(8\e(B ?\e$,1(9\e(B ?\e$,1(:\e(B ?\e$,1(;\e(B ?\e$,1(<\e(B ?\e$,1(=\e(B ?\e$,1(>\e(B ?\e$,1(?\e(B
363 ;; ?\e$,1(@\e(B ?\e$,1(A\e(B ?\e$,1(B\e(B ?\e$,1(C\e(B ?\e$,1(D\e(B ?\e$,1(E\e(B ?\e$,1(F\e(B ?\e$,1(G\e(B ?\e$,1(H\e(B ?\e$,1(I\e(B ?\e$,1(J\e(B ?\e$,1(K\e(B ?\e$,1(L\e(B ?\e$,1(M\e(B ?\e$,1(N\e(B ?\e$,1(O\e(B
364 ;; ?\e$,1(P\e(B ?\e$,1(Q\e(B ?\e$,1(R\e(B ?\e$,1(S\e(B ?\e$,1(T\e(B ?\e$,1(U\e(B ?\e$,1(V\e(B ?\e$,1(W\e(B ?\e$,1(X\e(B ?\e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e$,2 t\e(B ?\e$,2!)\e(B ?\e$,2!&\e(B ?\e$,2! \e(B ?\e$,2 p\e(B ?\e$,2!,\e(B ?\e$,2!'\e(B
376 ?\e$,2!(\e(B ?\e$,2!$\e(B ?\e$,2!%\e(B ?\e$,2 y\e(B ?\e$,2 x\e(B ?\e$,2 r\e(B ?\e$,2 s\e(B ?\e$,2!+\e(B ?\e$,2!*\e(B ?\e$,2 8\e(B ?\e$,2 ,\e(B ?\e$,2!H\e(B ?\e$,2!D\e(B ?\e$,2!L\e(B ?\e$,2!P\e(B ?\e$,2!@\e(B
377 ?\e,L`\e(B ?\e,La\e(B ?\e,Lb\e(B ?\e,Lc\e(B ?\e,Ld\e(B ?\e,Le\e(B ?\e,Lf\e(B ?\e,Lg\e(B ?\e,Lh\e(B ?\e,Li\e(B ?\e,Lj\e(B ?\e,Lk\e(B ?\e,Ll\e(B ?\e,Lm\e(B ?\e,Ln\e(B ?\e,Lo\e(B
378 ;; Taken from http://www.cyrillic.com/ref/cyrillic/koi-8alt.html
379 ;; with guesses for the Unicodes of the glyphs in the absence of a
381 ?\e,L!\e(B ?\e,Lq\e(B ?\e$,1ry\e(B ?\e$,1rx\e(B ?\e$,1%A\e(B ?\e$,1%@\e(B ?\e$,1s:\e(B ?\e$,1s9\e(B ?\e$,1vq\e(B ?\e$,1vs\e(B ?\e,A1\e(B ?\e,Aw\e(B ?\e,Lp\e(B ?\e,A$\e(B ?\e$,2!`\e(B ?\e,L \e(B]
382 "Cyrillic ALTERNATIVNYJ decoding table.
")
384 (let ((table (make-translation-table-from-vector
385 cyrillic-alternativnyj-decode-table)))
386 (define-translation-table 'cyrillic-alternativnyj-nonascii-translation-table
388 (define-translation-table 'cyrillic-alternativnyj-encode-table
389 (char-table-extra-slot table 0)))
391 (makunbound 'cyrillic-alternativnyj-decode-table)
393 (define-ccl-program ccl-decode-alternativnyj
400 ((translate-character cyrillic-alternativnyj-nonascii-translation-table
402 (translate-character ucs-translation-table-for-decode r0 r1)
403 (write-multibyte-character r0 r1)
405 "CCL program to decode Alternativnyj.
")
407 (define-ccl-program ccl-encode-alternativnyj
410 (read-multibyte-character r0 r1)
411 (translate-character cyrillic-alternativnyj-encode-table r0 r1)
412 (if (r0 != ,(charset-id 'ascii))
413 (if (r0 != ,(charset-id 'eight-bit-graphic))
414 (if (r0 != ,(charset-id 'eight-bit-control))
417 "CCL program to encode Alternativnyj.
")
419 (cyrillic-unify-encoding 'cyrillic-alternativnyj-encode-table)
422 'cyrillic-alternativnyj 4 ?A
423 "ALTERNATIVNYJ
8-bit encoding for Cyrillic.
"
424 '(ccl-decode-alternativnyj . ccl-encode-alternativnyj)
425 `((safe-chars . cyrillic-alternativnyj-encode-table)
426 (valid-codes (0 . 255))
427 (dependency unify-8859-on-encoding-mode unify-8859-on-decoding-mode)))
429 (define-coding-system-alias 'alternativnyj 'cyrillic-alternativnyj)
431 (define-ccl-program ccl-encode-alternativnyj-font
433 (translate-character cyrillic-alternativnyj-encode-table r0 r1))
434 "CCL program to encode Cyrillic chars to Alternativnyj font.
")
436 (add-to-list 'font-ccl-encoder-alist
437 '("alternativnyj
" . ccl-encode-alternativnyj-font))
439 (set-language-info-alist
440 "Cyrillic-ALT
" `((charset cyrillic-iso8859-5)
441 (nonascii-translation
442 . ,(get 'cyrillic-alternativnyj-nonascii-translation-table
444 (coding-system cyrillic-alternativnyj)
445 (coding-priority cyrillic-alternativnyj)
446 (input-method . "russian-typewriter
")
447 (features cyril-util)
448 (unibyte-display . cyrillic-alternativnyj)
449 (sample-text . "Russian
(\e,L
@caaZXY
\e(B) \e,L7T
`PRabRcYbU
\e(B!")
450 (documentation . "Support for Cyrillic ALTERNATIVNYJ.
"))
453 (set-language-info-alist
454 "Tajik
" `((coding-system cyrillic-koi8-t)
455 (coding-priority cyrillic-koi8-t)
456 (nonascii-translation
457 . ,(get 'decode-koi8-t 'translation-table))
458 (input-method . "russian-typewriter
") ; fixme?
459 (features code-pages)
460 (documentation . "Support for Tajik using KOI8-T.
"))
465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\e(B ?\\e$,1(6\e(B ?\\e$,1(7\e(B ?\\e$,1(8\e(B ?\\e$,1(9\e(B ?\\e$,1(:\e(B ?\\e$,1(;\e(B ?\\e$,1(<\e(B ?\\e$,1(=\e(B ?\\e$,1(>\e(B ?\\e$,1(?\e(B ?\\e$,1(@\e(B ?\\e$,1(A\e(B ?\\e$,1(B\e(B ?\\e$,1(C\e(B ?\\e$,1(D\e(B
473 ?\\e$,1(E\e(B ?\\e$,1(F\e(B ?\\e$,1(G\e(B ?\\e$,1(H\e(B ?\\e$,1(I\e(B ?\\e$,1(J\e(B ?\\e$,1(K\e(B ?\\e$,1(L\e(B ?\\e$,1(M\e(B ?\\e$,1(N\e(B ?\\e$,1(O\e(B ?\\e$,1(P\e(B ?\\e$,1(Q\e(B ?\\e$,1(R\e(B ?\\e$,1(S\e(B ?\\e$,1(T\e(B ?\\e$,1(U\e(B
474 ?\\e$,1(V\e(B ?\\e$,1(W\e(B ?\\e$,1(X\e(B ?\\e$,1(Y\e(B ?\\e$,1(Z\e(B ?\\e$,1([\e(B ?\\e$,1(\\e(B ?\\e$,1(]\e(B ?\\e$,1(^\e(B ?\\e$,1(_\e(B ?\\e$,1(`\e(B ?\\e$,1(a\e(B ?\\e$,1(b\e(B ?\\e$,1(c\e(B ?\\e$,1(d\e(B ?\\e$,1(e\e(B ?\\e$,1(f\e(B
475 ?\\e$,1(g\e(B ?\\e$,1(h\e(B ?\\e$,1(i\e(B ?\\e$,1(j\e(B ?\\e$,1(k\e(B ?\\e$,1(l\e(B ?\\e$,1(m\e(B ?\\e$,1(n\e(B ?\\e$,1(o\e(B] nil ?b)))
477 (define-coding-system-alias 'cp1251 'windows-1251)
479 (let ((elt `("microsoft-cp1251
" windows-1251 1
480 ,(get 'encode-windows-1251 'translation-table)))
481 (slot (assoc "microsoft-cp1251
" ctext-non-standard-encodings-alist)))
483 (setcdr slot (cdr elt))
484 (push elt ctext-non-standard-encodings-alist)))
486 (define-ccl-program ccl-encode-windows-1251-font
488 ((if (r0 == ,(charset-id 'mule-unicode-0100-24ff))
491 (translate-character encode-windows-1251 r0 r1))))
493 (add-to-list 'font-ccl-encoder-alist
494 '("microsoft-cp1251
" . ccl-encode-windows-1251-font))
496 (set-language-info-alist
497 "Bulgarian
" `((coding-system windows-1251)
498 (coding-priority windows-1251)
499 (ctext-non-standard-encodings "microsoft-cp1251
")
501 (,(get 'encode-windows-1251 'translation-table)
502 . (nil . "microsoft-cp1251
"))
503 (,(get 'cyrillic-koi8-r-encode-table 'translation-table)
505 (nonascii-translation
506 . ,(get 'decode-windows-1251 'translation-table))
507 (input-method . "bulgarian-bds
")
509 . "Support for Bulgarian with windows-1251 character set.
")
510 (tutorial . "TUTORIAL.bg
"))
513 (set-language-info-alist
514 "Belarusian
" `((coding-system windows-1251)
515 (coding-priority windows-1251)
516 (ctext-non-standard-encodings "microsoft-cp1251
")
518 (,(get 'encode-windows-1251 'translation-table)
519 . (nil . "microsoft-cp1251
"))
520 (,(get 'cyrillic-koi8-r-encode-table 'translation-table)
522 (nonascii-translation
523 . ,(get 'decode-windows-1251 'translation-table))
524 (input-method . "belarusian
")
526 . "Support for Belarusian with windows-1251 character set.
527 \
(The name Belarusian replaced Byelorussian in the early
1990s.
)"))
532 ;;; arch-tag: bda71ae0-ba41-4cb6-a6e0-1dff542313d3
533 ;;; cyrillic.el ends here