From: Katsumi Yamaoka <yamaoka@jpl.org>
Subject: unfold MIME header lines
Date: Fri, 16 Aug 2002 09:38:44 +0900 [thread overview]
Message-ID: <yotladnnwsbv.fsf@jpl.org> (raw)
Hi,
This article has the following Subject header and you may see
four lines just as it is.
Subject: =?us-ascii?Q?unfold?=
MIME
=?us-ascii?Q?header?=
lines
Things like this take place frequently in Japanse (or any other
non-ascii) messages and they are quite ugly. Gnus uses the
function `mail-decode-encoded-word-region' by default to decode
MIME headers which only removes a newline and whitespaces
between encoded words. It is correct in the eyes of RFC2231 but
it is unsatisfactory for Gnus as a living utensil.
Here is a hack to remove a newline and whitespaces between
encoded word and non-encoded word as well. It can be merged in
the function `rfc2047-decode-region' for the Gnus' default.
(defadvice mail-decode-encoded-word-region
(before remove-newline-and-whitespaces (start end) activate)
"Remove excessive newline and whitespaces around encoded words."
(save-excursion
(save-restriction
(narrow-to-region start end)
(let ((regexp (concat "\\(\\([\t ]*\n\\)?[\t ]+\\)"
rfc2047-encoded-word-regexp)))
(goto-char (point-min))
(while (re-search-forward rfc2047-encoded-word-regexp nil t)
(while (looking-at regexp)
(goto-char (match-end 0))
(delete-region (match-beginning 1) (match-end 1)))
(if (looking-at "\\([\t ]*\n\\)?[\t ]+")
(progn
(delete-region (match-beginning 0) (match-end 0))
(insert " "))))
(goto-char (point-min))
(while (re-search-forward regexp nil t)
(goto-char (match-beginning 1))
(delete-region (point) (match-end 1))
(insert " ")))
(setq end (point-max)))))
--
Katsumi Yamaoka <yamaoka@jpl.org>
next reply other threads:[~2002-08-16 0:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-08-16 0:38 Katsumi Yamaoka [this message]
2002-08-23 3:43 ` Jesper Harder
2002-08-23 4:17 ` Katsumi Yamaoka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=yotladnnwsbv.fsf@jpl.org \
--to=yamaoka@jpl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).