(fill-flowed-encode-tests): Use concatenated string to protect trailing
[gnus] / contrib / ucs-tables.el
1 ;;; ucs-tables.el --- translation to, from and via Unicode  -*- coding: iso-2022-7bit -*-
2
3 ;; Copyright (C) 2001  Free Software Foundation, Inc.
4
5 ;; Author: Dave Love <fx@gnu.org>
6 ;; Keywords: i18n
7
8 ;; This file is part of GNU Emacs.
9
10 ;; This file is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; any later version.
14
15 ;; This file is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 ;; GNU General Public License for more details.
19
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
22 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23 ;; Boston, MA 02110-1301, USA.
24
25 ;;; Commentary:
26
27 ;; This file provides tables mapping between Unicode numbers and
28 ;; emacs-mule characters from the iso-8859 charsets (and others).  It
29 ;; also provides some auxiliary functions.
30
31 ;; These tables are used to construct other mappings between the Mule
32 ;; iso8859 charsets and the emacs-unicode charsets and a table that
33 ;; unifies iso8859 characters using a single charset as far as
34 ;; possible.  These tables are used by latin1-disp.el to display some
35 ;; Unicode characters without a Unicode font and by utf-8.el to unify
36 ;; Latin-N as far as possible on encoding.
37
38 ;; More drastically, they can be used to unify 8859 into Latin-1 plus
39 ;; mule-unicode-0100-24ff on decoding, with the corresponding
40 ;; adjustments on encoding; see `ucs-unify-8859'.  Be wary of using
41 ;; unification when, for instance, editing Lisp files such as this one
42 ;; which are supposed to contain distinct 8859 charsets.  Also, it can
43 ;; make reading and writing of emacs-mule and iso-2022-based encodings
44 ;; not idempotent.
45
46 ;; Global minor modes are provided to unify on encoding and decoding.
47
48 ;; The translation table `ucs-mule-to-mule-unicode' is populated.
49 ;; This is used by the `mule-utf-8' coding system to encode extra
50 ;; characters.
51
52 ;; Command `ucs-insert' is convenient for inserting a given Unicode.
53 ;; (See also the `ucs' input method.)
54
55 ;;; Code:
56
57 (when (featurep 'xemacs)
58   (error "This file cannot be used with XEmacs.  For XEmacs, use latin-unity instead"))
59
60 ;;; Define tables, to be populated later.
61
62 (defvar ucs-mule-8859-to-ucs-table (make-translation-table)
63   "Translation table from Emacs ISO-8859 characters to Unicode.
64 This maps Emacs characters from the non-Latin-1
65 ...-iso8859-... charsets to their Unicode code points.  This is a
66 many-to-one mapping.")
67
68 (defvar ucs-mule-8859-to-mule-unicode (make-translation-table)
69   "Translation table from Emacs ISO-8859 characters to Mule Unicode.
70 This maps Emacs characters from the non-Latin-1
71 ...-iso8859-... charsets to characters from the
72 mule-unicode-... charsets.  This is a many-to-one mapping.  The
73 characters translated to are suitable for encoding using the
74 `mule-utf-8' coding system.")
75
76 ;; (defvar ucs-ucs-to-mule-8859-table (make-translation-table)
77 ;;   "Translation table from Unicode to Emacs ISO-8859 characters.
78 ;; This maps Unicode code points to corresponding Emacs characters from
79 ;; the ...-iso8859-... charsets.  This is made a one-to-one mapping where
80 ;; the same character occurs in more than one set by preferring the Emacs
81 ;; iso-8859-N character with lowest N.")
82
83 ;; (defvar ucs-mule-unicode-to-mule-8859 (make-translation-table)
84 ;;   "Translation table from Mule Unicode to Emacs ISO-8859 characters.
85 ;; This maps non-Latin-1 Emacs characters from the
86 ;; mule-unicode-... charsets used by the `mule-utf-8' coding system to
87 ;; characters from the ...-iso8859-... charsets.  This is made a
88 ;; one-to-one mapping where the same character occurs in more than one
89 ;; set by preferring the Emacs iso-8859-N character with lowest N.")
90
91 (defvar ucs-8859-1-encode-table nil
92   "Used as `translation-table-for-encode' for iso-8859-2.
93 Translates from the iso8859 charsets and `mule-unicode-0100-24ff'.")
94
95 (defvar ucs-8859-2-encode-table nil
96   "Used as `translation-table-for-encode' for iso-8859-2.
97 Translates from the iso8859 charsets and `mule-unicode-0100-24ff'.")
98
99 (defvar ucs-8859-3-encode-table nil
100   "Used as `translation-table-for-encode' for iso-8859-3.
101 Translates from the iso8859 charsets and `mule-unicode-0100-24ff'.")
102
103 (defvar ucs-8859-4-encode-table nil
104   "Used as `translation-table-for-encode' for iso-8859-4.
105 Translates from the iso8859 charsets and `mule-unicode-0100-24ff'.")
106
107 (defvar ucs-8859-5-encode-table nil
108   "Used as `translation-table-for-encode' for iso-8859-5.
109 Translates from the iso8859 charsets and `mule-unicode-0100-24ff'.")
110
111 (defvar ucs-8859-7-encode-table nil
112   "Used as `translation-table-for-encode' for iso-8859-7.
113 Translates from the iso8859 charsets and `mule-unicode-0100-24ff'.")
114
115 (defvar ucs-8859-8-encode-table nil
116   "Used as `translation-table-for-encode' for iso-8859-8.