+1999-12-09 20:39:49 Shenghuo ZHU <zsh@cs.rochester.edu>
+
+ * mm-util.el (mm-charset-after): New function.
+ (mm-find-mime-charset-region): Set charsets after
+ delete-duplicates and use find-coding-systems-region.
+ (mm-find-charset-region): Remove composition.
+
+ * mm-bodies.el (mm-encode-body): Use mm-charset-after.
+
+ * mml.el (mml-parse-singlepart-with-multiple-charsets): Ditto.
+
1999-12-09 17:47:56 Shenghuo ZHU <zsh@cs.rochester.edu>
* mm-util.el (mm-find-mime-charset-region): Revoke last change.
(or (get-charset-property charset 'prefered-coding-system)
(get-charset-property charset 'preferred-coding-system)))
+(defun mm-charset-after (&optional pos)
+ "Return charset of a character in current buffer at position POS.
+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 (charset-after pos)))
+ (if (eq charset 'composition)
+ (let ((p (or pos (point))))
+ (cadr (find-charset-region p (1+ p))))
+ charset)))
+
(defun mm-mime-charset (charset)
"Return the MIME charset corresponding to the MULE CHARSET."
(if (fboundp 'coding-system-get)
(mm-find-charset-region b e)))))
(when (memq 'iso-2022-jp-2 charsets)
(setq charsets (delq 'iso-2022-jp charsets)))
- (delete-duplicates charsets)
+ (setq charsets (delete-duplicates charsets))
(if (and (> (length charsets) 1)
- (fboundp 'find-coding-systems-for-charsets)
- (memq 'utf-8 (find-coding-systems-for-charsets charsets)))
+ (fboundp 'find-coding-systems-region)
+ (memq 'utf-8 (find-coding-systems-region b e)))
'(utf-8)
charsets)))
(cond
((and (mm-multibyte-p)
(fboundp 'find-charset-region))
- (find-charset-region b e))
+ ;; Remove composition since the base charsets have been included.
+ (delq 'composition (find-charset-region b e)))
((not (boundp 'current-language-environment))
(save-excursion
(save-restriction
(save-excursion
(narrow-to-region beg end)
(goto-char (point-min))
- (let ((current (or (mm-mime-charset (char-charset (following-char)))
+ (let ((current (or (mm-mime-charset (mm-charset-after))
(and use-ascii 'us-ascii)))
charset struct space newline paragraph)
(while (not (eobp))
(cond
;; The charset remains the same.
- ((or (eq (setq charset (mm-mime-charset
- (char-charset (following-char)))) 'us-ascii)
+ ((or (eq (setq charset (mm-mime-charset (mm-charset-after)))
+ 'us-ascii)
(and use-ascii (not charset))
(eq charset current)))
;; The initial charset was ascii.