Commit ef14acfb authored by Lars Ingebrigtsen's avatar Lars Ingebrigtsen

Make nnml handle invalid non-ASCII headers more consistently

* lisp/gnus/nnml.el (nnml--encode-headers): New function to
RFC2047-encode invalid Subject/From headers (bug#45925).  This
will make them be displayed more consistently in the Summary
buffer (but still "wrong" sometimes, since there's not that much
we can guess at at this stage, charset wise).
(nnml-parse-head): Use it.
parent b2b26bd4
Pipeline #8923 passed with stages
in 8 minutes and 2 seconds
......@@ -769,8 +769,24 @@ article number. This function is called narrowed to an article."
(let ((headers (nnheader-parse-head t)))
(setf (mail-header-chars headers) chars)
(setf (mail-header-number headers) number)
;; If there's non-ASCII raw characters in the data,
;; RFC2047-encode them to avoid having arbitrary data in the
;; .overview file.
(nnml--encode-headers headers)
(defun nnml--encode-headers (headers)
(let ((subject (mail-header-subject headers))
(rfc2047-encoding-type 'mime))
(unless (string-match "\\`[[:ascii:]]*\\'" subject)
(setf (mail-header-subject headers)
(mail-encode-encoded-word-string subject t))))
(let ((from (mail-header-from headers))
(rfc2047-encoding-type 'address-mime))
(unless (string-match "\\`[[:ascii:]]*\\'" from)
(setf (mail-header-from headers)
(rfc2047-encode-string from t)))))
(defun nnml-get-nov-buffer (group &optional incrementalp)
(let ((buffer (gnus-get-buffer-create
(format " *nnml %soverview %s*"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment