X-Git-Url: https://cgit.sxemacs.org/?a=blobdiff_plain;f=lisp%2Frfc2047.el;h=924f7ab83a18ae8b8b211ea8558b9ae01eed5337;hb=a2b194368efe5e061d2ea3711d55782e5ab23ca2;hp=f65854583ad38fc88ef04123f8a76942f930de24;hpb=717ca9569b0b24703f86453886b21a41210dfe80;p=gnus diff --git a/lisp/rfc2047.el b/lisp/rfc2047.el index f65854583..924f7ab83 100644 --- a/lisp/rfc2047.el +++ b/lisp/rfc2047.el @@ -42,6 +42,7 @@ (defvar rfc2047-header-encoding-alist '(("Newsgroups" . nil) + ("Followup-To" . nil) ("Message-ID" . nil) ("\\(Resent-\\)?\\(From\\|Cc\\|To\\|Bcc\\|Reply-To\\|Sender\\)" . "-A-Za-z0-9!*+/=_") @@ -478,7 +479,7 @@ The buffer may be narrowed." (pop alist)) ;; The size of QP encapsulation is about 20, so set limit to ;; 56=76-20. - (unless (< (buffer-size) 56) + (unless (< (- (point-max) (point-min)) 56) ;; Don't break if it could fit in one line. ;; Let rfc2047-encode-region break it later. (goto-char (1+ (point-min))) @@ -538,7 +539,7 @@ 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)))))) + (mm-decode-coding-region-safely b (point-max) mail-parse-charset)))))) (defun rfc2047-decode-string (string) "Decode the quoted-printable-encoded STRING and return the results." @@ -555,7 +556,12 @@ 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-string string mail-parse-charset) + (let* ((decoded (mm-decode-coding-string string mail-parse-charset)) + (charsets (find-charset-string decoded))) + (if (or (memq 'eight-bit-control charsets) + (memq 'eight-bit-graphic charsets)) + (mm-decode-coding-string string 'undecided) + decoded)) string)))) (defun rfc2047-parse-and-decode (word)