From 141f7aa5543b075ea77830c5c7e988f3e4538df3 Mon Sep 17 00:00:00 2001 From: Andrew G Cohen Date: Sun, 3 Nov 2019 10:48:52 +0800 Subject: [PATCH] Update header parsing in nnheader.el * lisp/gnus/nnheader.el (nnheader-parse-naked-head, nnheader-parse-nov): Update the parsing functions to align with the parsing in gnus-get-newsgroup-headers. This fixes some utf issues. --- lisp/gnus/nnheader.el | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/lisp/gnus/nnheader.el b/lisp/gnus/nnheader.el index 28c4cebb2d1..54d40d57b78 100644 --- a/lisp/gnus/nnheader.el +++ b/lisp/gnus/nnheader.el @@ -209,19 +209,23 @@ on your system, you could say something like: ;; about twice as fast, even though it looks messier. You ;; can't have everything, I guess. Speed and elegance don't ;; always go hand in hand. - (vector + (make-full-mail-header ;; Number. (or number 0) ;; Subject. (progn (goto-char p) (if (search-forward "\nsubject:" nil t) - (nnheader-header-value) "(none)")) + (funcall gnus-decode-encoded-word-function + (nnheader-header-value)) + "(none)")) ;; From. (progn (goto-char p) (if (search-forward "\nfrom:" nil t) - (nnheader-header-value) "(nobody)")) + (funcall gnus-decode-encoded-address-function + (nnheader-header-value)) + "(nobody)")) ;; Date. (progn (goto-char p) @@ -349,11 +353,20 @@ on your system, you could say something like: (defun nnheader-parse-nov () (let ((eol (point-at-eol)) - (number (nnheader-nov-read-integer))) - (vector + (number (nnheader-nov-read-integer)) + x) + (make-full-mail-header number ; number - (nnheader-nov-field) ; subject - (nnheader-nov-field) ; from + (condition-case () ; subject + (gnus-remove-odd-characters + (funcall gnus-decode-encoded-word-function + (setq x (nnheader-nov-field)))) + (error x)) + (condition-case () ; from + (gnus-remove-odd-characters + (funcall gnus-decode-encoded-address-function + (setq x (nnheader-nov-field)))) + (error x)) (nnheader-nov-field) ; date (nnheader-nov-read-message-id number) ; id (nnheader-nov-field) ; refs -- 2.39.5