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.9 1996/04/16 13:42:44 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*)
50 ("ISO-8859-7" . *iso-8859-7*)
51 ("ISO-8859-8" . *iso-8859-8*)
52 ("ISO-8859-9" . *iso-8859-9*)
53 ("ISO-2022-INT-1" . *iso-2022-int-1*)
54 ("SHIFT_JIS" . *sjis*)
55 ("X-SHIFTJIS" . *sjis*)
59 ;;; @ leading-character and charset
62 (defvar mime/lc-charset-alist
64 (cons (list lc-ascii) "US-ASCII")
65 (cons (list lc-ascii lc-ltn1) "ISO-8859-1")
66 (cons (list lc-ascii lc-ltn2) "ISO-8859-2")
67 (cons (list lc-ascii lc-ltn3) "ISO-8859-3")
68 (cons (list lc-ascii lc-ltn4) "ISO-8859-4")
69 ;;;(cons (list lc-ascii lc-crl) "ISO-8859-5")
70 (cons (list lc-ascii lc-crl) "KOI8-R")
71 (cons (list lc-ascii lc-grk) "ISO-8859-7")
72 (cons (list lc-ascii lc-hbw) "ISO-8859-8")
73 (cons (list lc-ascii lc-ltn5) "ISO-8859-9")
74 (cons (list lc-ascii lc-jp) "ISO-2022-JP")
75 (cons (list lc-ascii lc-kr) "EUC-KR")
79 lc-ltn1 lc-grk) "ISO-2022-JP-2")
84 lc-ltn1 lc-grk) "ISO-2022-INT-1")
87 (defvar mime/unknown-charset "ISO-2022-INT-1")
93 (defun mime/convert-string-to-emacs (charset str)
94 (let ((cs (cdr (assoc charset mime/charset-coding-system-alist))))
96 (code-convert-string str cs *internal*)
99 (defun mime/convert-string-from-emacs (str charset)
100 (let ((cs (cdr (assoc charset mime/charset-coding-system-alist))))
102 (code-convert-string str *internal* cs)
105 (defun mime/code-convert-region-to-emacs (beg end charset &optional encoding)
106 (if (stringp charset)
108 (setq charset (upcase charset))
109 (let ((ct (cdr (assoc charset mime/charset-coding-system-alist))))
111 (code-convert beg end ct *internal*)
113 (if mime/default-coding-system
114 (code-convert beg end mime/default-coding-system *internal*)
123 (run-hooks 'tm-mule-load-hook)
125 ;;; tm-mule.el ends here