X-Git-Url: https://cgit.sxemacs.org/?a=blobdiff_plain;f=lisp%2Frfc2047.el;h=1947b9e2acbd5e8fe360fd6113d7508784b0b1ea;hb=0fb3ca6ec4c82ed8de7880a455c20e47e6017b3a;hp=e3eb8f463af140a17580679444b6a3500bf739b7;hpb=b828b842fe938f655f01aafb1cc70e428b23fcc4;p=gnus diff --git a/lisp/rfc2047.el b/lisp/rfc2047.el index e3eb8f463..1947b9e2a 100644 --- a/lisp/rfc2047.el +++ b/lisp/rfc2047.el @@ -184,7 +184,7 @@ Should be called narrowed to the head of the message." ;; left the old code commented out below. ;; -- Per Abrahamsen Date: 2001-10-07. ((null method) - (when (delq 'ascii + (when (delq 'ascii (mm-find-charset-region (point-min) (point-max))) (rfc2047-encode-region (point-min) (point-max)))) ;;; ((null method) @@ -433,18 +433,15 @@ The buffer may be narrowed." (let ((bol (save-restriction (widen) (gnus-point-at-bol))) - (eol (gnus-point-at-eol)) - leading) + (eol (gnus-point-at-eol))) (forward-line 1) (while (not (eobp)) - (looking-at "[ \t]*") - (setq leading (- (match-end 0) (match-beginning 0))) - (if (< (- (gnus-point-at-eol) bol leading) 76) - (progn - (goto-char eol) - (delete-region eol (progn - (skip-chars-forward " \t\n\r") - (1- (point))))) + (if (and (looking-at "[ \t]") + (< (- (gnus-point-at-eol) bol) 76)) + (delete-region eol (progn + (goto-char eol) + (skip-chars-forward "\r\n") + (point))) (setq bol (gnus-point-at-bol))) (setq eol (gnus-point-at-eol)) (forward-line 1))))) @@ -522,6 +519,7 @@ The buffer may be narrowed." (delete-region (match-beginning 0) (match-end 0))))) (when (and (mm-multibyte-p) mail-parse-charset + (not (eq mail-parse-charset 'us-ascii)) (not (eq mail-parse-charset 'gnus-decoded))) (mm-decode-coding-region b e mail-parse-charset)) (setq b (point))) @@ -529,21 +527,25 @@ The buffer may be narrowed." mail-parse-charset (not (eq mail-parse-charset 'us-ascii)) (not (eq mail-parse-charset 'gnus-decoded))) - (mm-decode-coding-region b (point-max) mail-parse-charset)) - (rfc2047-unfold-region (point-min) (point-max)))))) + (mm-decode-coding-region b (point-max) mail-parse-charset)))))) (defun rfc2047-decode-string (string) "Decode the quoted-printable-encoded STRING and return the results." - (if (string-match "=\\?" string) - (let ((m (mm-multibyte-p))) + (let ((m (mm-multibyte-p))) + (if (string-match "=\\?" string) (with-temp-buffer (when m (mm-enable-multibyte)) (insert string) (inline (rfc2047-decode-region (point-min) (point-max))) - (buffer-string))) - string)) + (buffer-string)) + (if (and m + mail-parse-charset + (not (eq mail-parse-charset 'us-ascii)) + (not (eq mail-parse-charset 'gnus-decoded))) + (mm-decode-coding-string string mail-parse-charset) + string)))) (defun rfc2047-parse-and-decode (word) "Decode WORD and return it if it is an encoded word.