(whitespace): Set :version tag to 23.1.
[emacs.git] / lisp / international / iso-cvt.el
blob083676adf4cb66194f7e04432be446a40fd01892
1 ;;; iso-cvt.el --- translate ISO 8859-1 from/to various encodings -*- coding: iso-latin-1 -*-
2 ;; This file was formerly called gm-lingo.el.
4 ;; Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001,
5 ;; 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
7 ;; Author: Michael Gschwind <mike@vlsivie.tuwien.ac.at>
8 ;; Keywords: tex, iso, latin, 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 3, or (at your option)
15 ;; any later version.
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., 51 Franklin Street, Fifth Floor,
25 ;; Boston, MA 02110-1301, USA.
27 ;;; Commentary:
28 ;; This lisp code is a general framework for translating various
29 ;; representations of the same data.
30 ;; among other things it can be used to translate TeX, HTML, and compressed
31 ;; files to ISO 8859-1. It can also be used to translate different charsets
32 ;; such as IBM PC, Macintosh or HP Roman8.
33 ;; Note that many translations use the GNU recode tool to do the actual
34 ;; conversion. So you might want to install that tool to get the full
35 ;; benefit of iso-cvt.el
37 ; TO DO:
38 ; Cover more cases for translation. (There is an infinite number of ways to
39 ; represent accented characters in TeX)
41 ;; SEE ALSO:
42 ; If you are interested in questions related to using the ISO 8859-1
43 ; characters set (configuring emacs, Unix, etc. to use ISO), then you
44 ; can get the ISO 8859-1 FAQ via anonymous ftp from
45 ; ftp.vlsivie.tuwien.ac.at in /pub/8bit/FAQ-ISO-8859-1
47 ;;; Code:
49 (defvar iso-spanish-trans-tab
51 ("~n" "ñ")
52 ("\([a-zA-Z]\)#" "\\1ñ")
53 ("~N" "Ñ")
54 ("\\([-a-zA-Z\"`]\\)\"u" "\\1ü")
55 ("\\([-a-zA-Z\"`]\\)\"U" "\\1Ü")
56 ("\\([-a-zA-Z]\\)'o" "\\1ó")
57 ("\\([-a-zA-Z]\\)'O" "\\Ó")
58 ("\\([-a-zA-Z]\\)'e" "\\1é")
59 ("\\([-a-zA-Z]\\)'E" "\\1É")
60 ("\\([-a-zA-Z]\\)'a" "\\1á")
61 ("\\([-a-zA-Z]\\)'A" "\\1A")
62 ("\\([-a-zA-Z]\\)'i" "\\1í")
63 ("\\([-a-zA-Z]\\)'I" "\\1Í")
65 "Spanish translation table.")
67 (defun iso-translate-conventions (from to trans-tab)
68 "Translate between FROM and TO using the translation table TRANS-TAB."
69 (save-excursion
70 (save-restriction
71 (narrow-to-region from to)
72 (goto-char from)
73 (let ((work-tab trans-tab)
74 (buffer-read-only nil)
75 (case-fold-search nil))
76 (while work-tab
77 (save-excursion
78 (let ((trans-this (car work-tab)))
79 (while (re-search-forward (car trans-this) nil t)
80 (replace-match (car (cdr trans-this)) t nil)))
81 (setq work-tab (cdr work-tab)))))
82 (point-max))))
84 ;;;###autoload
85 (defun iso-spanish (from to &optional buffer)
86 "Translate net conventions for Spanish to ISO 8859-1.
87 Translate the region between FROM and TO using the table
88 `iso-spanish-trans-tab'.
89 Optional arg BUFFER is ignored (for use in `format-alist')."
90 (interactive "*r")
91 (iso-translate-conventions from to iso-spanish-trans-tab))
93 (defvar iso-aggressive-german-trans-tab
95 ("\"a" "ä")
96 ("\"A" "Ä")
97 ("\"o" "ö")
98 ("\"O" "Ö")
99 ("\"u" "ü")
100 ("\"U" "Ü")
101 ("\"s" "ß")
102 ("\\\\3" "ß")
104 "German translation table.
105 This table uses an aggressive translation approach
106 and may erroneously translate too much.")
108 (defvar iso-conservative-german-trans-tab
110 ("\\([-a-zA-Z\"`]\\)\"a" "\\1ä")
111 ("\\([-a-zA-Z\"`]\\)\"A" "\\1Ä")
112 ("\\([-a-zA-Z\"`]\\)\"o" "\\1ö")
113 ("\\([-a-zA-Z\"`]\\)\"O" "\\1Ö")
114 ("\\([-a-zA-Z\"`]\\)\"u" "\\1ü")
115 ("\\([-a-zA-Z\"`]\\)\"U" "\\1Ü")
116 ("\\([-a-zA-Z\"`]\\)\"s" "\\1ß")
117 ("\\([-a-zA-Z\"`]\\)\\\\3" "\\1ß")
119 "German translation table.
120 This table uses a conservative translation approach
121 and may translate too little.")
123 (defvar iso-german-trans-tab iso-aggressive-german-trans-tab
124 "Currently active translation table for German.")
126 ;;;###autoload
127 (defun iso-german (from to &optional buffer)
128 "Translate net conventions for German to ISO 8859-1.
129 Translate the region FROM and TO using the table
130 `iso-german-trans-tab'.
131 Optional arg BUFFER is ignored (for use in `format-alist')."
132 (interactive "*r")
133 (iso-translate-conventions from to iso-german-trans-tab))
135 (defvar iso-iso2tex-trans-tab
137 ("ä" "{\\\\\"a}")
138 ("à" "{\\\\`a}")
139 ("á" "{\\\\'a}")
140 ("ã" "{\\\\~a}")
141 ("â" "{\\\\^a}")
142 ("ë" "{\\\\\"e}")
143 ("è" "{\\\\`e}")
144 ("é" "{\\\\'e}")
145 ("ê" "{\\\\^e}")
146 ("ï" "{\\\\\"\\\\i}")
147 ("ì" "{\\\\`\\\\i}")
148 ("í" "{\\\\'\\\\i}")
149 ("î" "{\\\\^\\\\i}")
150 ("ö" "{\\\\\"o}")
151 ("ò" "{\\\\`o}")
152 ("ó" "{\\\\'o}")
153 ("õ" "{\\\\~o}")
154 ("ô" "{\\\\^o}")
155 ("ü" "{\\\\\"u}")
156 ("ù" "{\\\\`u}")
157 ("ú" "{\\\\'u}")
158 ("û" "{\\\\^u}")
159 ("Ä" "{\\\\\"A}")
160 ("À" "{\\\\`A}")
161 ("Á" "{\\\\'A}")
162 ("Ã" "{\\\\~A}")
163 ("Â" "{\\\\^A}")
164 ("Ë" "{\\\\\"E}")
165 ("È" "{\\\\`E}")
166 ("É" "{\\\\'E}")
167 ("Ê" "{\\\\^E}")
168 ("Ï" "{\\\\\"I}")
169 ("Ì" "{\\\\`I}")
170 ("Í" "{\\\\'I}")
171 ("Î" "{\\\\^I}")
172 ("Ö" "{\\\\\"O}")
173 ("Ò" "{\\\\`O}")
174 ("Ó" "{\\\\'O}")
175 ("Õ" "{\\\\~O}")
176 ("Ô" "{\\\\^O}")
177 ("Ü" "{\\\\\"U}")
178 ("Ù" "{\\\\`U}")
179 ("Ú" "{\\\\'U}")
180 ("Û" "{\\\\^U}")
181 ("ñ" "{\\\\~n}")
182 ("Ñ" "{\\\\~N}")
183 ("ç" "{\\\\c c}")
184 ("Ç" "{\\\\c C}")
185 ("ß" "{\\\\ss}")
186 ("\306" "{\\\\AE}")
187 ("\346" "{\\\\ae}")
188 ("\305" "{\\\\AA}")
189 ("\345" "{\\\\aa}")
190 ("\251" "{\\\\copyright}")
191 ("£" "{\\\\pounds}")
192 ("¶" "{\\\\P}")
193 ("§" "{\\\\S}")
194 ("¿" "{?`}")
195 ("¡" "{!`}")
197 "Translation table for translating ISO 8859-1 characters to TeX sequences.")
199 ;;;###autoload
200 (defun iso-iso2tex (from to &optional buffer)
201 "Translate ISO 8859-1 characters to TeX sequences.
202 Translate the region between FROM and TO using the table
203 `iso-iso2tex-trans-tab'.
204 Optional arg BUFFER is ignored (for use in `format-alist')."
205 (interactive "*r")
206 (iso-translate-conventions from to iso-iso2tex-trans-tab))
208 (defvar iso-tex2iso-trans-tab
210 ("{\\\\\"a}" "ä")
211 ("{\\\\`a}" "à")
212 ("{\\\\'a}" "á")
213 ("{\\\\~a}" "ã")
214 ("{\\\\^a}" "â")
215 ("{\\\\\"e}" "ë")
216 ("{\\\\`e}" "è")
217 ("{\\\\'e}" "é")
218 ("{\\\\^e}" "ê")
219 ("{\\\\\"\\\\i}" "ï")
220 ("{\\\\`\\\\i}" "ì")
221 ("{\\\\'\\\\i}" "í")
222 ("{\\\\^\\\\i}" "î")
223 ("{\\\\\"i}" "ï")
224 ("{\\\\`i}" "ì")
225 ("{\\\\'i}" "í")
226 ("{\\\\^i}" "î")
227 ("{\\\\\"o}" "ö")
228 ("{\\\\`o}" "ò")
229 ("{\\\\'o}" "ó")
230 ("{\\\\~o}" "õ")
231 ("{\\\\^o}" "ô")
232 ("{\\\\\"u}" "ü")
233 ("{\\\\`u}" "ù")
234 ("{\\\\'u}" "ú")
235 ("{\\\\^u}" "û")
236 ("{\\\\\"A}" "Ä")
237 ("{\\\\`A}" "À")
238 ("{\\\\'A}" "Á")
239 ("{\\\\~A}" "Ã")
240 ("{\\\\^A}" "Â")
241 ("{\\\\\"E}" "Ë")
242 ("{\\\\`E}" "È")
243 ("{\\\\'E}" "É")
244 ("{\\\\^E}" "Ê")
245 ("{\\\\\"I}" "Ï")
246 ("{\\\\`I}" "Ì")
247 ("{\\\\'I}" "Í")
248 ("{\\\\^I}" "Î")
249 ("{\\\\\"O}" "Ö")
250 ("{\\\\`O}" "Ò")
251 ("{\\\\'O}" "Ó")
252 ("{\\\\~O}" "Õ")
253 ("{\\\\^O}" "Ô")
254 ("{\\\\\"U}" "Ü")
255 ("{\\\\`U}" "Ù")
256 ("{\\\\'U}" "Ú")
257 ("{\\\\^U}" "Û")
258 ("{\\\\~n}" "ñ")
259 ("{\\\\~N}" "Ñ")
260 ("{\\\\c c}" "ç")
261 ("{\\\\c C}" "Ç")
262 ("\\\\\"a" "ä")
263 ("\\\\`a" "à")
264 ("\\\\'a" "á")
265 ("\\\\~a" "ã")
266 ("\\\\^a" "â")
267 ("\\\\\"e" "ë")
268 ("\\\\`e" "è")
269 ("\\\\'e" "é")
270 ("\\\\^e" "ê")
271 ;; Discard spaces and/or one EOF after macro \i.
272 ;; Converting it back will use braces.
273 ("\\\\\"\\\\i *\n\n" \n\n")
274 ("\\\\\"\\\\i *\n?" "ï")
275 ("\\\\`\\\\i *\n\n" \n\n")
276 ("\\\\`\\\\i *\n?" "ì")
277 ("\\\\'\\\\i *\n\n" \n\n")
278 ("\\\\'\\\\i *\n?" "í")
279 ("\\\\^\\\\i *\n\n" \n\n")
280 ("\\\\^\\\\i *\n?" "î")
281 ("\\\\\"i" "ï")
282 ("\\\\`i" "ì")
283 ("\\\\'i" "í")
284 ("\\\\^i" "î")
285 ("\\\\\"o" "ö")
286 ("\\\\`o" "ò")
287 ("\\\\'o" "ó")
288 ("\\\\~o" "õ")
289 ("\\\\^o" "ô")
290 ("\\\\\"u" "ü")
291 ("\\\\`u" "ù")
292 ("\\\\'u" "ú")
293 ("\\\\^u" "û")
294 ("\\\\\"A" "Ä")
295 ("\\\\`A" "À")
296 ("\\\\'A" "Á")
297 ("\\\\~A" "Ã")
298 ("\\\\^A" "Â")
299 ("\\\\\"E" "Ë")
300 ("\\\\`E" "È")
301 ("\\\\'E" "É")
302 ("\\\\^E" "Ê")
303 ("\\\\\"I" "Ï")
304 ("\\\\`I" "Ì")
305 ("\\\\'I" "Í")
306 ("\\\\^I" "Î")
307 ("\\\\\"O" "Ö")
308 ("\\\\`O" "Ò")
309 ("\\\\'O" "Ó")
310 ("\\\\~O" "Õ")
311 ("\\\\^O" "Ô")
312 ("\\\\\"U" "Ü")
313 ("\\\\`U" "Ù")
314 ("\\\\'U" "Ú")
315 ("\\\\^U" "Û")
316 ("\\\\~n" "ñ")
317 ("\\\\~N" "Ñ")
318 ("\\\\\"{a}" "ä")
319 ("\\\\`{a}" "à")
320 ("\\\\'{a}" "á")
321 ("\\\\~{a}" "ã")
322 ("\\\\^{a}" "â")
323 ("\\\\\"{e}" "ë")
324 ("\\\\`{e}" "è")
325 ("\\\\'{e}" "é")
326 ("\\\\^{e}" "ê")
327 ("\\\\\"{\\\\i}" "ï")
328 ("\\\\`{\\\\i}" "ì")
329 ("\\\\'{\\\\i}" "í")
330 ("\\\\^{\\\\i}" "î")
331 ("\\\\\"{i}" "ï")
332 ("\\\\`{i}" "ì")
333 ("\\\\'{i}" "í")
334 ("\\\\^{i}" "î")
335 ("\\\\\"{o}" "ö")
336 ("\\\\`{o}" "ò")
337 ("\\\\'{o}" "ó")
338 ("\\\\~{o}" "õ")
339 ("\\\\^{o}" "ô")
340 ("\\\\\"{u}" "ü")
341 ("\\\\`{u}" "ù")
342 ("\\\\'{u}" "ú")
343 ("\\\\^{u}" "û")
344 ("\\\\\"{A}" "Ä")
345 ("\\\\`{A}" "À")
346 ("\\\\'{A}" "Á")
347 ("\\\\~{A}" "Ã")
348 ("\\\\^{A}" "Â")
349 ("\\\\\"{E}" "Ë")
350 ("\\\\`{E}" "È")
351 ("\\\\'{E}" "É")
352 ("\\\\^{E}" "Ê")
353 ("\\\\\"{I}" "Ï")
354 ("\\\\`{I}" "Ì")
355 ("\\\\'{I}" "Í")
356 ("\\\\^{I}" "Î")
357 ("\\\\\"{O}" "Ö")
358 ("\\\\`{O}" "Ò")
359 ("\\\\'{O}" "Ó")
360 ("\\\\~{O}" "Õ")
361 ("\\\\^{O}" "Ô")
362 ("\\\\\"{U}" "Ü")
363 ("\\\\`{U}" "Ù")
364 ("\\\\'{U}" "Ú")
365 ("\\\\^{U}" "Û")
366 ("\\\\~{n}" "ñ")
367 ("\\\\~{N}" "Ñ")
368 ("\\\\c{c}" "ç")
369 ("\\\\c{C}" "Ç")
370 ("{\\\\ss}" "ß")
371 ("{\\\\AE}" "\306")
372 ("{\\\\ae}" "\346")
373 ("{\\\\AA}" "\305")
374 ("{\\\\aa}" "\345")
375 ("{\\\\copyright}" "\251")
376 ("\\\\copyright{}" "\251")
377 ("{\\\\pounds}" "£" )
378 ("{\\\\P}" "¶" )
379 ("{\\\\S}" "§" )
380 ("\\\\pounds{}" "£" )
381 ("\\\\P{}" "¶" )
382 ("\\\\S{}" "§" )
383 ("{\\?`}" "¿")
384 ("{!`}" "¡")
385 ("\\?`" "¿")
386 ("!`" "¡")
388 "Translation table for translating TeX sequences to ISO 8859-1 characters.
389 This table is not exhaustive (and due to TeX's power can never be).
390 It only contains commonly used sequences.")
392 ;;;###autoload
393 (defun iso-tex2iso (from to &optional buffer)
394 "Translate TeX sequences to ISO 8859-1 characters.
395 Translate the region between FROM and TO using the table
396 `iso-tex2iso-trans-tab'.
397 Optional arg BUFFER is ignored (for use in `format-alist')."
398 (interactive "*r")
399 (iso-translate-conventions from to iso-tex2iso-trans-tab))
401 (defvar iso-gtex2iso-trans-tab
403 ("{\\\\\"a}" "ä")
404 ("{\\\\`a}" "à")
405 ("{\\\\'a}" "á")
406 ("{\\\\~a}" "ã")
407 ("{\\\\^a}" "â")
408 ("{\\\\\"e}" "ë")
409 ("{\\\\`e}" "è")
410 ("{\\\\'e}" "é")
411 ("{\\\\^e}" "ê")
412 ("{\\\\\"\\\\i}" "ï")
413 ("{\\\\`\\\\i}" "ì")
414 ("{\\\\'\\\\i}" "í")
415 ("{\\\\^\\\\i}" "î")
416 ("{\\\\\"i}" "ï")
417 ("{\\\\`i}" "ì")
418 ("{\\\\'i}" "í")
419 ("{\\\\^i}" "î")
420 ("{\\\\\"o}" "ö")
421 ("{\\\\`o}" "ò")
422 ("{\\\\'o}" "ó")
423 ("{\\\\~o}" "õ")
424 ("{\\\\^o}" "ô")
425 ("{\\\\\"u}" "ü")
426 ("{\\\\`u}" "ù")
427 ("{\\\\'u}" "ú")
428 ("{\\\\^u}" "û")
429 ("{\\\\\"A}" "Ä")
430 ("{\\\\`A}" "À")
431 ("{\\\\'A}" "Á")
432 ("{\\\\~A}" "Ã")
433 ("{\\\\^A}" "Â")
434 ("{\\\\\"E}" "Ë")
435 ("{\\\\`E}" "È")
436 ("{\\\\'E}" "É")
437 ("{\\\\^E}" "Ê")
438 ("{\\\\\"I}" "Ï")
439 ("{\\\\`I}" "Ì")
440 ("{\\\\'I}" "Í")
441 ("{\\\\^I}" "Î")
442 ("{\\\\\"O}" "Ö")
443 ("{\\\\`O}" "Ò")
444 ("{\\\\'O}" "Ó")
445 ("{\\\\~O}" "Õ")
446 ("{\\\\^O}" "Ô")
447 ("{\\\\\"U}" "Ü")
448 ("{\\\\`U}" "Ù")
449 ("{\\\\'U}" "Ú")
450 ("{\\\\^U}" "Û")
451 ("{\\\\~n}" "ñ")
452 ("{\\\\~N}" "Ñ")
453 ("{\\\\c c}" "ç")
454 ("{\\\\c C}" "Ç")
455 ("\\\\\"a" "ä")
456 ("\\\\`a" "à")
457 ("\\\\'a" "á")
458 ("\\\\~a" "ã")
459 ("\\\\^a" "â")
460 ("\\\\\"e" "ë")
461 ("\\\\`e" "è")
462 ("\\\\'e" "é")
463 ("\\\\^e" "ê")
464 ("\\\\\"\\\\i" "ï")
465 ("\\\\`\\\\i" "ì")
466 ("\\\\'\\\\i" "í")
467 ("\\\\^\\\\i" "î")
468 ("\\\\\"i" "ï")
469 ("\\\\`i" "ì")
470 ("\\\\'i" "í")
471 ("\\\\^i" "î")
472 ("\\\\\"o" "ö")
473 ("\\\\`o" "ò")
474 ("\\\\'o" "ó")
475 ("\\\\~o" "õ")
476 ("\\\\^o" "ô")
477 ("\\\\\"u" "ü")
478 ("\\\\`u" "ù")
479 ("\\\\'u" "ú")
480 ("\\\\^u" "û")
481 ("\\\\\"A" "Ä")
482 ("\\\\`A" "À")
483 ("\\\\'A" "Á")
484 ("\\\\~A" "Ã")
485 ("\\\\^A" "Â")
486 ("\\\\\"E" "Ë")
487 ("\\\\`E" "È")
488 ("\\\\'E" "É")
489 ("\\\\^E" "Ê")
490 ("\\\\\"I" "Ï")
491 ("\\\\`I" "Ì")
492 ("\\\\'I" "Í")
493 ("\\\\^I" "Î")
494 ("\\\\\"O" "Ö")
495 ("\\\\`O" "Ò")
496 ("\\\\'O" "Ó")
497 ("\\\\~O" "Õ")
498 ("\\\\^O" "Ô")
499 ("\\\\\"U" "Ü")
500 ("\\\\`U" "Ù")
501 ("\\\\'U" "Ú")
502 ("\\\\^U" "Û")
503 ("\\\\~n" "ñ")
504 ("\\\\~N" "Ñ")
505 ("\\\\\"{a}" "ä")
506 ("\\\\`{a}" "à")
507 ("\\\\'{a}" "á")
508 ("\\\\~{a}" "ã")
509 ("\\\\^{a}" "â")
510 ("\\\\\"{e}" "ë")
511 ("\\\\`{e}" "è")
512 ("\\\\'{e}" "é")
513 ("\\\\^{e}" "ê")
514 ("\\\\\"{\\\\i}" "ï")
515 ("\\\\`{\\\\i}" "ì")
516 ("\\\\'{\\\\i}" "í")
517 ("\\\\^{\\\\i}" "î")
518 ("\\\\\"{i}" "ï")
519 ("\\\\`{i}" "ì")
520 ("\\\\'{i}" "í")
521 ("\\\\^{i}" "î")
522 ("\\\\\"{o}" "ö")
523 ("\\\\`{o}" "ò")
524 ("\\\\'{o}" "ó")
525 ("\\\\~{o}" "õ")
526 ("\\\\^{o}" "ô")
527 ("\\\\\"{u}" "ü")
528 ("\\\\`{u}" "ù")
529 ("\\\\'{u}" "ú")
530 ("\\\\^{u}" "û")
531 ("\\\\\"{A}" "Ä")
532 ("\\\\`{A}" "À")
533 ("\\\\'{A}" "Á")
534 ("\\\\~{A}" "Ã")
535 ("\\\\^{A}" "Â")
536 ("\\\\\"{E}" "Ë")
537 ("\\\\`{E}" "È")
538 ("\\\\'{E}" "É")
539 ("\\\\^{E}" "Ê")
540 ("\\\\\"{I}" "Ï")
541 ("\\\\`{I}" "Ì")
542 ("\\\\'{I}" "Í")
543 ("\\\\^{I}" "Î")
544 ("\\\\\"{O}" "Ö")
545 ("\\\\`{O}" "Ò")
546 ("\\\\'{O}" "Ó")
547 ("\\\\~{O}" "Õ")
548 ("\\\\^{O}" "Ô")
549 ("\\\\\"{U}" "Ü")
550 ("\\\\`{U}" "Ù")
551 ("\\\\'{U}" "Ú")
552 ("\\\\^{U}" "Û")
553 ("\\\\~{n}" "ñ")
554 ("\\\\~{N}" "Ñ")
555 ("\\\\c{c}" "ç")
556 ("\\\\c{C}" "Ç")
557 ("{\\\\ss}" "ß")
558 ("{\\\\AE}" "\306")
559 ("{\\\\ae}" "\346")
560 ("{\\\\AA}" "\305")
561 ("{\\\\aa}" "\345")
562 ("{\\\\copyright}" "\251")
563 ("\\\\copyright{}" "\251")
564 ("{\\\\pounds}" "£" )
565 ("{\\\\P}" "¶" )
566 ("{\\\\S}" "§" )
567 ("\\\\pounds{}" "£" )
568 ("\\\\P{}" "¶" )
569 ("\\\\S{}" "§" )
570 ("?`" "¿")
571 ("!`" "¡")
572 ("{?`}" "¿")
573 ("{!`}" "¡")
574 ("\"a" "ä")
575 ("\"A" "Ä")
576 ("\"o" "ö")
577 ("\"O" "Ö")
578 ("\"u" "ü")
579 ("\"U" "Ü")
580 ("\"s" "ß")
581 ("\\\\3" "ß")
583 "Translation table for translating German TeX sequences to ISO 8859-1.
584 This table is not exhaustive (and due to TeX's power can never be).
585 It only contains commonly used sequences.")
587 (defvar iso-iso2gtex-trans-tab
589 ("ä" "\"a")
590 ("à" "{\\\\`a}")
591 ("á" "{\\\\'a}")
592 ("ã" "{\\\\~a}")
593 ("â" "{\\\\^a}")
594 ("ë" "{\\\\\"e}")
595 ("è" "{\\\\`e}")
596 ("é" "{\\\\'e}")
597 ("ê" "{\\\\^e}")
598 ("ï" "{\\\\\"\\\\i}")
599 ("ì" "{\\\\`\\\\i}")
600 ("í" "{\\\\'\\\\i}")
601 ("î" "{\\\\^\\\\i}")
602 ("ö" "\"o")
603 ("ò" "{\\\\`o}")
604 ("ó" "{\\\\'o}")
605 ("õ" "{\\\\~o}")
606 ("ô" "{\\\\^o}")
607 ("ü" "\"u")
608 ("ù" "{\\\\`u}")
609 ("ú" "{\\\\'u}")
610 ("û" "{\\\\^u}")
611 ("Ä" "\"A")
612 ("À" "{\\\\`A}")
613 ("Á" "{\\\\'A}")
614 ("Ã" "{\\\\~A}")
615 ("Â" "{\\\\^A}")
616 ("Ë" "{\\\\\"E}")
617 ("È" "{\\\\`E}")
618 ("É" "{\\\\'E}")
619 ("Ê" "{\\\\^E}")
620 ("Ï" "{\\\\\"I}")
621 ("Ì" "{\\\\`I}")
622 ("Í" "{\\\\'I}")
623 ("Î" "{\\\\^I}")
624 ("Ö" "\"O")
625 ("Ò" "{\\\\`O}")
626 ("Ó" "{\\\\'O}")
627 ("Õ" "{\\\\~O}")
628 ("Ô" "{\\\\^O}")
629 ("Ü" "\"U")
630 ("Ù" "{\\\\`U}")
631 ("Ú" "{\\\\'U}")
632 ("Û" "{\\\\^U}")
633 ("ñ" "{\\\\~n}")
634 ("Ñ" "{\\\\~N}")
635 ("ç" "{\\\\c c}")
636 ("Ç" "{\\\\c C}")
637 ("ß" "\"s")
638 ("\306" "{\\\\AE}")
639 ("\346" "{\\\\ae}")
640 ("\305" "{\\\\AA}")
641 ("\345" "{\\\\aa}")
642 ("\251" "{\\\\copyright}")
643 ("£" "{\\\\pounds}")
644 ("¶" "{\\\\P}")
645 ("§" "{\\\\S}")
646 ("¿" "{?`}")
647 ("¡" "{!`}")
649 "Translation table for translating ISO 8859-1 characters to German TeX.")
651 ;;;###autoload
652 (defun iso-gtex2iso (from to &optional buffer)
653 "Translate German TeX sequences to ISO 8859-1 characters.
654 Translate the region between FROM and TO using the table
655 `iso-gtex2iso-trans-tab'.
656 Optional arg BUFFER is ignored (for use in `format-alist')."
657 (interactive "*r")
658 (iso-translate-conventions from to iso-gtex2iso-trans-tab))
660 ;;;###autoload
661 (defun iso-iso2gtex (from to &optional buffer)
662 "Translate ISO 8859-1 characters to German TeX sequences.
663 Translate the region between FROM and TO using the table
664 `iso-iso2gtex-trans-tab'.
665 Optional arg BUFFER is ignored (for use in `format-alist')."
666 (interactive "*r")
667 (iso-translate-conventions from to iso-iso2gtex-trans-tab))
669 (defvar iso-iso2duden-trans-tab
670 '(("ä" "ae")
671 ("Ä" "Ae")
672 ("ö" "oe")
673 ("Ö" "Oe")
674 ("ü" "ue")
675 ("Ü" "Ue")
676 ("ß" "ss"))
677 "Translation table for translating ISO 8859-1 characters to Duden sequences.")
679 ;;;###autoload
680 (defun iso-iso2duden (from to &optional buffer)
681 "Translate ISO 8859-1 characters to Duden sequences.
682 Translate the region between FROM and TO using the table
683 `iso-iso2duden-trans-tab'.
684 Optional arg BUFFER is ignored (for use in `format-alist')."
685 (interactive "*r")
686 (iso-translate-conventions from to iso-iso2duden-trans-tab))
688 (defvar iso-iso2sgml-trans-tab
689 '(("À" "&Agrave;")
690 ("Á" "&Aacute;")
691 ("Â" "&Acirc;")
692 ("Ã" "&Atilde;")
693 ("Ä" "&Auml;")
694 ("Å" "&Aring;")
695 ("Æ" "&AElig;")
696 ("Ç" "&Ccedil;")
697 ("È" "&Egrave;")
698 ("É" "&Eacute;")
699 ("Ê" "&Ecirc;")
700 ("Ë" "&Euml;")
701 ("Ì" "&Igrave;")
702 ("Í" "&Iacute;")
703 ("Î" "&Icirc;")
704 ("Ï" "&Iuml;")
705 ("Ð" "&ETH;")
706 ("Ñ" "&Ntilde;")
707 ("Ò" "&Ograve;")
708 ("Ó" "&Oacute;")
709 ("Ô" "&Ocirc;")
710 ("Õ" "&Otilde;")
711 ("Ö" "&Ouml;")
712 ("Ø" "&Oslash;")
713 ("Ù" "&Ugrave;")
714 ("Ú" "&Uacute;")
715 ("Û" "&Ucirc;")
716 ("Ü" "&Uuml;")
717 ("Ý" "&Yacute;")
718 ("Þ" "&THORN;")
719 ("ß" "&szlig;")
720 ("à" "&agrave;")
721 ("á" "&aacute;")
722 ("â" "&acirc;")
723 ("ã" "&atilde;")
724 ("ä" "&auml;")
725 ("å" "&aring;")
726 ("æ" "&aelig;")
727 ("ç" "&ccedil;")
728 ("è" "&egrave;")
729 ("é" "&eacute;")
730 ("ê" "&ecirc;")
731 ("ë" "&euml;")
732 ("ì" "&igrave;")
733 ("í" "&iacute;")
734 ("î" "&icirc;")
735 ("ï" "&iuml;")
736 ("ð" "&eth;")
737 ("ñ" "&ntilde;")
738 ("ò" "&ograve;")
739 ("ó" "&oacute;")
740 ("ô" "&ocirc;")
741 ("õ" "&otilde;")
742 ("ö" "&ouml;")
743 ("ø" "&oslash;")
744 ("ù" "&ugrave;")
745 ("ú" "&uacute;")
746 ("û" "&ucirc;")
747 ("ü" "&uuml;")
748 ("ý" "&yacute;")
749 ("þ" "&thorn;")
750 ("ÿ" "&yuml;")))
752 (defvar iso-sgml2iso-trans-tab
753 '(("&Agrave;" "À")
754 ("&Aacute;" "Á")
755 ("&Acirc;" "Â")
756 ("&Atilde;" "Ã")
757 ("&Auml;" "Ä")
758 ("&Aring;" "Å")
759 ("&AElig;" "Æ")
760 ("&Ccedil;" "Ç")
761 ("&Egrave;" "È")
762 ("&Eacute;" "É")
763 ("&Ecirc;" "Ê")
764 ("&Euml;" "Ë")
765 ("&Igrave;" "Ì")
766 ("&Iacute;" "Í")
767 ("&Icirc;" "Î")
768 ("&Iuml;" "Ï")
769 ("&ETH;" "Ð")
770 ("&Ntilde;" "Ñ")
771 ("&Ograve;" "Ò")
772 ("&Oacute;" "Ó")
773 ("&Ocirc;" "Ô")
774 ("&Otilde;" "Õ")
775 ("&Ouml;" "Ö")
776 ("&Oslash;" "Ø")
777 ("&Ugrave;" "Ù")
778 ("&Uacute;" "Ú")
779 ("&Ucirc;" "Û")
780 ("&Uuml;" "Ü")
781 ("&Yacute;" "Ý")
782 ("&THORN;" "Þ")
783 ("&szlig;" "ß")
784 ("&agrave;" "à")
785 ("&aacute;" "á")
786 ("&acirc;" "â")
787 ("&atilde;" "ã")
788 ("&auml;" "ä")
789 ("&aring;" "å")
790 ("&aelig;" "æ")
791 ("&ccedil;" "ç")
792 ("&egrave;" "è")
793 ("&eacute;" "é")
794 ("&ecirc;" "ê")
795 ("&euml;" "ë")
796 ("&igrave;" "ì")
797 ("&iacute;" "í")
798 ("&icirc;" "î")
799 ("&iuml;" "ï")
800 ("&eth;" "ð")
801 ("&ntilde;" "ñ")
802 ("&nbsp;" " ")
803 ("&ograve;" "ò")
804 ("&oacute;" "ó")
805 ("&ocirc;" "ô")
806 ("&otilde;" "õ")
807 ("&ouml;" "ö")
808 ("&oslash;" "ø")
809 ("&ugrave;" "ù")
810 ("&uacute;" "ú")
811 ("&ucirc;" "û")
812 ("&uuml;" "ü")
813 ("&yacute;" "ý")
814 ("&thorn;" "þ")
815 ("&yuml;" "ÿ")))
817 ;;;###autoload
818 (defun iso-iso2sgml (from to &optional buffer)
819 "Translate ISO 8859-1 characters in the region to SGML entities.
820 Use entities from \"ISO 8879:1986//ENTITIES Added Latin 1//EN\".
821 Optional arg BUFFER is ignored (for use in `format-alist')."
822 (interactive "*r")
823 (iso-translate-conventions from to iso-iso2sgml-trans-tab))
825 ;;;###autoload
826 (defun iso-sgml2iso (from to &optional buffer)
827 "Translate SGML entities in the region to ISO 8859-1 characters.
828 Use entities from \"ISO 8879:1986//ENTITIES Added Latin 1//EN\".
829 Optional arg BUFFER is ignored (for use in `format-alist')."
830 (interactive "*r")
831 (iso-translate-conventions from to iso-sgml2iso-trans-tab))
833 ;;;###autoload
834 (defun iso-cvt-read-only (&rest ignore)
835 "Warn that format is read-only."
836 (interactive)
837 (error "This format is read-only; specify another format for writing"))
839 ;;;###autoload
840 (defun iso-cvt-write-only (&rest ignore)
841 "Warn that format is write-only."
842 (interactive)
843 (error "This format is write-only"))
845 ;;;###autoload
846 (defun iso-cvt-define-menu ()
847 "Add submenus to the File menu, to convert to and from various formats."
848 (interactive)
850 (let ((load-as-menu-map (make-sparse-keymap "Load As..."))
851 (insert-as-menu-map (make-sparse-keymap "Insert As..."))
852 (write-as-menu-map (make-sparse-keymap "Write As..."))
853 (translate-to-menu-map (make-sparse-keymap "Translate to..."))
854 (translate-from-menu-map (make-sparse-keymap "Translate from..."))
855 (menu menu-bar-file-menu))
857 (define-key menu [load-as-separator] '("--"))
859 (define-key menu [load-as] '("Load As..." . iso-cvt-load-as))
860 (fset 'iso-cvt-load-as load-as-menu-map)
862 ;;(define-key menu [insert-as] '("Insert As..." . iso-cvt-insert-as))
863 (fset 'iso-cvt-insert-as insert-as-menu-map)
865 (define-key menu [write-as] '("Write As..." . iso-cvt-write-as))
866 (fset 'iso-cvt-write-as write-as-menu-map)
868 (define-key menu [translate-separator] '("--"))
870 (define-key menu [translate-to] '("Translate to..." . iso-cvt-translate-to))
871 (fset 'iso-cvt-translate-to translate-to-menu-map)
873 (define-key menu [translate-from] '("Translate from..." . iso-cvt-translate-from))
874 (fset 'iso-cvt-translate-from translate-from-menu-map)
876 (dolist (file-type (reverse format-alist))
877 (let ((name (car file-type))
878 (str-name (cadr file-type)))
879 (if (stringp str-name)
880 (progn
881 (define-key load-as-menu-map (vector name)
882 (cons str-name
883 `(lambda (file)
884 (interactive ,(format "FFind file (as %s): " name))
885 (format-find-file file ',name))))
886 (define-key insert-as-menu-map (vector name)
887 (cons str-name
888 `(lambda (file)
889 (interactive (format "FInsert file (as %s): " ,name))
890 (format-insert-file file ',name))))
891 (define-key write-as-menu-map (vector name)
892 (cons str-name
893 `(lambda (file)
894 (interactive (format "FWrite file (as %s): " ,name))
895 (format-write-file file ',name))))
896 (define-key translate-to-menu-map (vector name)
897 (cons str-name
898 `(lambda ()
899 (interactive)
900 (format-encode-buffer ',name))))
901 (define-key translate-from-menu-map (vector name)
902 (cons str-name
903 `(lambda ()
904 (interactive)
905 (format-decode-buffer ',name))))))))))
907 (provide 'iso-cvt)
909 ;; arch-tag: 64ae843f-ed0e-43e1-ba50-ffd581b90840
910 ;;; iso-cvt.el ends here