2 ;;; tm-mule.el --- tm definitions depended on Mule
4 ;;; Copyright (C) 1995 Free Software Foundation, Inc.
5 ;;; Copyright (C) 1994 .. 1996 MORIOKA Tomohiko
7 ;;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
9 ;;; $Id: tm-mule.el,v 7.8 1996/02/12 16:02:05 morioka Exp $
10 ;;; Keywords: mail, news, MIME, multimedia, multilingual, encoded-word
12 ;;; This file is part of tm (Tools for MIME).
14 ;;; This program is free software; you can redistribute it and/or
15 ;;; modify it under the terms of the GNU General Public License as
16 ;;; published by the Free Software Foundation; either version 2, or
17 ;;; (at your option) any later version.
19 ;;; This program is distributed in the hope that it will be useful,
20 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
21 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 ;;; General Public License for more details.
24 ;;; You should have received a copy of the GNU General Public License
25 ;;; along with This program. If not, write to the Free Software
26 ;;; Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
37 (defvar mime/charset-coding-system-alist
38 '(("ISO-2022-JP" . *iso-2022-ss2-7*)
39 ("ISO-2022-JP-2" . *iso-2022-ss2-7*)
40 ("X-ISO-2022-JP-2" . *iso-2022-ss2-7*)
41 ("ISO-2022-CN" . *iso-2022-ss2-7*)
42 ("ISO-2022-KR" . *iso-2022-kr*)
44 ("ISO-8859-1" . *ctext*)
45 ("ISO-8859-2" . *iso-8859-2*)
46 ("ISO-8859-3" . *iso-8859-3*)
47 ("ISO-8859-4" . *iso-8859-4*)
48 ("ISO-8859-5" . *iso-8859-5*)
49 ("ISO-8859-7" . *iso-8859-7*)
50 ("ISO-8859-8" . *iso-8859-8*)
51 ("ISO-8859-9" . *iso-8859-9*)
52 ("ISO-2022-INT-1" . *iso-2022-int-1*)
53 ("SHIFT_JIS" . *sjis*)
54 ("X-SHIFTJIS" . *sjis*)
58 ;;; @ leading-character and charset
61 (defvar mime/lc-charset-alist
63 (cons (list lc-ascii) "US-ASCII")
64 (cons (list lc-ascii lc-ltn1) "ISO-8859-1")
65 (cons (list lc-ascii lc-ltn2) "ISO-8859-2")
66 (cons (list lc-ascii lc-ltn3) "ISO-8859-3")
67 (cons (list lc-ascii lc-ltn4) "ISO-8859-4")
68 ;;;(cons (list lc-ascii lc-crl) "ISO-8859-5")
69 (cons (list lc-ascii lc-crl) "KOI8-R")
70 (cons (list lc-ascii lc-grk) "ISO-8859-7")
71 (cons (list lc-ascii lc-hbw) "ISO-8859-8")
72 (cons (list lc-ascii lc-ltn5) "ISO-8859-9")
73 (cons (list lc-ascii lc-jp) "ISO-2022-JP")
74 (cons (list lc-ascii lc-kr) "EUC-KR")
78 lc-ltn1 lc-grk) "ISO-2022-JP-2")
83 lc-ltn1 lc-grk) "ISO-2022-INT-1")
86 (defvar mime/unknown-charset "ISO-2022-INT-1")
92 (defun mime/convert-string-to-emacs (charset str)
93 (let ((cs (cdr (assoc charset mime/charset-coding-system-alist))))
95 (code-convert-string str cs *internal*)
98 (defun mime/convert-string-from-emacs (str charset)
99 (let ((cs (cdr (assoc charset mime/charset-coding-system-alist))))
101 (code-convert-string str *internal* cs)
104 (defun mime/code-convert-region-to-emacs (beg end charset &optional encoding)
105 (if (stringp charset)
107 (setq charset (upcase charset))
108 (let ((ct (cdr (assoc charset mime/charset-coding-system-alist))))
110 (code-convert beg end ct *internal*)
112 (if mime/default-coding-system
113 (code-convert beg end mime/default-coding-system *internal*)
122 (run-hooks 'tm-mule-load-hook)
124 ;;; tm-mule.el ends here