Gnus development mailing list
 help / color / mirror / Atom feed
* unfold MIME header lines
@ 2002-08-16  0:38 Katsumi Yamaoka
  2002-08-23  3:43 ` Jesper Harder
  0 siblings, 1 reply; 3+ messages in thread
From: Katsumi Yamaoka @ 2002-08-16  0:38 UTC (permalink / 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>



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: unfold MIME header lines
  2002-08-16  0:38 unfold MIME header lines Katsumi Yamaoka
@ 2002-08-23  3:43 ` Jesper Harder
  2002-08-23  4:17   ` Katsumi Yamaoka
  0 siblings, 1 reply; 3+ messages in thread
From: Jesper Harder @ 2002-08-23  3:43 UTC (permalink / raw)


Katsumi Yamaoka <yamaoka@jpl.org> writes:

> 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.

But your subject line looked like this

Subject: unfold MIME header lines

to me.  Isn't this how you want it to look or am I missing something?




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: unfold MIME header lines
  2002-08-23  3:43 ` Jesper Harder
@ 2002-08-23  4:17   ` Katsumi Yamaoka
  0 siblings, 0 replies; 3+ messages in thread
From: Katsumi Yamaoka @ 2002-08-23  4:17 UTC (permalink / raw)


>>>>> In <m365y2s0if.fsf@defun.localdomain>
>>>>>	Jesper Harder <harder@ifa.au.dk> wrote:

> Katsumi Yamaoka <yamaoka@jpl.org> writes:

>> 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

> But your subject line looked like this

> Subject: unfold MIME header lines

> to me.  Isn't this how you want it to look or am I missing something?

OOPS!  I've set the option `gnus-treat-unfold-headers' to nil.
`head' the default value brings me a good visibility.  Thanks.
-- 
Katsumi Yamaoka <yamaoka@jpl.org>



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-08-23  4:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-16  0:38 unfold MIME header lines Katsumi Yamaoka
2002-08-23  3:43 ` Jesper Harder
2002-08-23  4:17   ` Katsumi Yamaoka

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).