tm 6.19
[elisp/tm.git] / tm-nemacs.el
1 ;;;
2 ;;; $Id: tm-nemacs.el,v 5.1 1994/10/26 15:08:12 morioka Exp $
3 ;;;
4
5 (provide 'tm-nemacs)
6
7 (require 'tl-18)
8 (require 'tl-nemacs)
9
10
11 ;;; @ variables
12 ;;;
13
14 (defvar mime/lc-charset-and-encoding-alist
15   (list
16    (cons lc-ascii nil)
17    (cons lc-jp   '("ISO-2022-JP" . "B"))
18    ))
19
20 (defvar mime/latin-lc-list
21   (list lc-ascii))
22        
23 ;; by mol. 1993/10/4
24 (defun mime/convert-string-to-emacs (charset str)
25   (cond ((string-match "^ISO-2022-JP$" charset)
26          (convert-string-kanji-code str 2 3))
27         ((string-match "^US-ASCII$" charset) str)
28         ((string-match "^ISO-8859-[1-9]$" charset)
29          (check-ASCII-string str))
30         (t nil)
31         ))
32
33 ;; by mol. 1993/11/2
34 (defun mime/convert-string-from-emacs (string charset)
35   (cond ((equal charset "ISO-2022-JP")
36          (code-convert-string string *internal* *junet*))
37         ((equal charset "US-ASCII") string)
38         (t nil)
39         ))
40
41 ;; by mol. 1993/10/4
42 (defun mime/decode-encoded-text (charset encoding str)
43   (let ((ds (mime/convert-string-to-emacs
44              charset
45              (cond ((string-match "^B$" encoding)
46                     (mime/base64-decode-string str))
47                    ((string-match "^Q$" encoding)
48                     (mime/Quoted-Printable-decode-string str))
49                    (t
50                     (message "unknown encoding %s" encoding)
51                     (concat "=?" charset "?" encoding "?" str "?=")
52                     )))))
53     (if ds
54         ds
55       (concat "=?" charset "?" encoding "?" str "?="))
56     ))
57
58 (defun mime/code-convert-region-to-emacs (beg end charset)
59   (if (stringp charset)
60       (progn
61         (setq charset (upcase charset))
62         (if (string= charset "ISO-2022-JP")
63             (convert-region-kanji-code beg end 2 3)
64           ))))