From e046788b0bfa3038f831326fc7d066ac5c93c57b Mon Sep 17 00:00:00 2001 From: ShengHuo ZHU Date: Sat, 18 Dec 1999 21:52:23 +0000 Subject: [PATCH] mm-charset-after in non-MULE case. --- lisp/ChangeLog | 6 ++++++ lisp/mail-prsvr.el | 4 ++++ lisp/mm-util.el | 26 ++++++++++++++++++++++---- lisp/rfc2047.el | 2 +- 4 files changed, 33 insertions(+), 5 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d488d4678..14f035382 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +1999-12-18 16:43:37 Shenghuo ZHU + + * mm-util.el (mm-charset-after): Non-MULE case. + * mail-prsvr.el (mail-parse-mule-charset): New variable. + * rfc2047.el (rfc2047-dissect-region): Bind it. + 1999-12-18 Florian Weimer * mml.el (mml-generate-multipart-alist): Correct default value. diff --git a/lisp/mail-prsvr.el b/lisp/mail-prsvr.el index 82187fc94..de4378705 100644 --- a/lisp/mail-prsvr.el +++ b/lisp/mail-prsvr.el @@ -29,6 +29,10 @@ This variable should never be set. Instead, it should be bound by functions that wish to call mail-parse functions and let them know what the desired charset is to be.") +(defvar mail-parse-mule-charset nil + "Default MULE charset used by low-level libraries. +This variable should never be set.") + (defvar mail-parse-ignored-charsets nil "Ignored charsets used by low-level libraries. This variable should never be set. Instead, it should be bound by diff --git a/lisp/mm-util.el b/lisp/mm-util.el index 69861e918..bf94df4c6 100644 --- a/lisp/mm-util.el +++ b/lisp/mm-util.el @@ -24,6 +24,8 @@ ;;; Code: +(require 'mail-prsvr) + (defvar mm-mime-mule-charset-alist '((us-ascii ascii) (iso-8859-1 latin-iso8859-1) @@ -65,7 +67,6 @@ chinese-cns11643-7)) "Alist of MIME-charset/MULE-charsets.") - (eval-and-compile (mapcar (lambda (elem) @@ -213,9 +214,26 @@ used as the line break code type of the coding system." If POS is nil, it defauls to the current point. If POS is out of range, the value is nil. If the charset is `composition', return the actual one." - (let ((charset (if (fboundp 'charset-after) - (charset-after pos) - (char-charset (char-after pos))))) + (let ((charset (cond + ((fboundp 'charset-after) + (charset-after pos)) + ((fboundp 'char-charset) + (char-charset (char-after pos))) + ((< (mm-char-int (char-after pos)) 128) + 'ascii) + (mail-parse-mule-charset ;; cached mule-charset + mail-parse-mule-charset) + ((boundp 'current-language-environment) + (let ((entry (assoc current-language-environment + language-info-alist))) + (setq mail-parse-mule-charset + (or (car (last (assq 'charset entry))) + 'latin-iso8859-1)))) + (t ;; figure out the charset + (setq mail-parse-mule-charset + (or (car (last (assq mail-parse-charset + mm-mime-mule-charset-alist))) + 'latin-iso8859-1)))))) (if (eq charset 'composition) (let ((p (or pos (point)))) (cadr (find-charset-region p (1+ p)))) diff --git a/lisp/rfc2047.el b/lisp/rfc2047.el index 3e377a7f6..2c0d2757e 100644 --- a/lisp/rfc2047.el +++ b/lisp/rfc2047.el @@ -157,7 +157,7 @@ permitted unencoded charset is us-ascii." (let ((all-specials (concat ietf-drums-tspecials " \t\n\r")) (special-list (mapcar 'identity ietf-drums-tspecials)) (blank-list '(? ?\t ?\n ?\r)) - words current cs state) + words current cs state mail-parse-mule-charset) (save-restriction (narrow-to-region b e) (goto-char (point-min)) -- 2.34.1