* nnimap.el (nnimap-split-fancy): Ditto.
[gnus] / lisp / rfc2047.el
index f658545..924f7ab 100644 (file)
@@ -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)