From 3ff91e30cdfa2372b76051e2a4c5ed4b2e72c875 Mon Sep 17 00:00:00 2001 From: Katsumi Yamaoka Date: Fri, 5 Aug 2005 05:58:05 +0000 Subject: [PATCH] * mm-bodies.el (mm-encode-body): Use coding system rather than charset to encode text. * mm-util.el (mm-find-mime-charset-region): Attempt to reduce the number of charsets if utf-8 is available (XEmacs). --- lisp/ChangeLog | 8 ++++++++ lisp/mm-bodies.el | 5 +++-- lisp/mm-util.el | 11 +++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 47d35bc35..f4e86a2dc 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2005-08-05 Katsumi Yamaoka + + * mm-bodies.el (mm-encode-body): Use coding system rather than + charset to encode text. + + * mm-util.el (mm-find-mime-charset-region): Attempt to reduce the + number of charsets if utf-8 is available (XEmacs). + 2005-08-04 Reiner Steib * gnus-art.el (gnus-button-valid-localpart-regexp): New variable diff --git a/lisp/mm-bodies.el b/lisp/mm-bodies.el index a9b34bea1..940febc28 100644 --- a/lisp/mm-bodies.el +++ b/lisp/mm-bodies.el @@ -1,6 +1,6 @@ ;;; mm-bodies.el --- Functions for decoding MIME things -;; Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004 +;; Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004, 2005 ;; Free Software Foundation, Inc. ;; Author: Lars Magne Ingebrigtsen @@ -93,7 +93,8 @@ If no encoding was done, nil is returned." (save-excursion (if charset (progn - (mm-encode-coding-region (point-min) (point-max) charset) + (mm-encode-coding-region (point-min) (point-max) + (mm-charset-to-coding-system charset)) charset) (goto-char (point-min)) (let ((charsets (mm-find-mime-charset-region (point-min) (point-max) diff --git a/lisp/mm-util.el b/lisp/mm-util.el index 2517919c3..b1cda890a 100644 --- a/lisp/mm-util.el +++ b/lisp/mm-util.el @@ -747,6 +747,17 @@ charset, and a longer list means no appropriate charset." (if (and (memq 'iso-2022-jp-2 charsets) (memq 'iso-2022-jp-2 hack-charsets)) (setq charsets (delq 'iso-2022-jp charsets))) + ;; Attempt to reduce the number of charsets if utf-8 is available. + (if (and (featurep 'xemacs) + (> (length charsets) 1) + (mm-coding-system-p 'utf-8)) + (let ((mm-coding-system-priorities + (cons 'utf-8 mm-coding-system-priorities))) + (setq charsets + (mm-delete-duplicates + (mapcar 'mm-mime-charset + (delq 'ascii + (mm-find-charset-region b e))))))) charsets)) (defmacro mm-with-unibyte-buffer (&rest forms) -- 2.25.1