Gnus development mailing list
 help / color / mirror / Atom feed
* Format=flowed & QP
@ 2002-10-03  2:28 Jesper Harder
  2002-12-29 15:31 ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Jesper Harder @ 2002-10-03  2:28 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 1141 bytes --]

There's a bug when you enable format=flowed in QP-encoded messages.

With soft newlines this message:

------------------------------------------------------------
Subject: test
Gcc: nnml+archive:misc-mail
From: Jesper Harder <harder@ifa.au.dk>
--text follows this line--
1234567890 1234567890 123456789 01234567890 0123456789 ælsdkfj æa sdlfkj

α
------------------------------------------------------------

Gets encoded like this:

------------------------------------------------------------
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: quoted-printable

1234567890 1234567890 123456789 01234567890 0123456789 
=C3=A6lsdkfj =C3=A6a= sdlfkj

=CE=B1
------------------------------------------------------------

Note the "a= ", which is malformed QP.

I think the problem is that `fill-flowed-encode' is applied *after*
QP-encoding (which I don't think is the right order).

Reversing that order seems to fix it¹.  But maybe we shouldn't flow text
at all unless the CTE is 8bit or 7bit?  (because QP supports soft
linebreaks without f=f).

¹

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: mml.el.diff --]
[-- Type: text/x-patch, Size: 1950 bytes --]

--- /home/harder/gnus/lisp/mml.el	Wed Sep  4 03:55:14 2002
+++ mml.el	Thu Oct  3 04:23:49 2002
@@ -431,26 +431,26 @@
 		      ;; ignore 0x1b, it is part of iso-2022-jp
 		      (setq encoding (mm-body-7-or-8))))
 		   (t
+		    ;; Only perform format=flowed filling on text/plain
+		    ;; parts where there either isn't a format parameter
+		    ;; in the mml tag or it says "flowed" and there
+		    ;; actually are hard newlines in the text.
+		    (let (use-hard-newlines)
+		      (when (and (string= type "text/plain")
+				 (or (null (assq 'format cont))
+				     (string= (cdr (assq 'format cont))
+					      "flowed"))
+				 (setq use-hard-newlines
+				       (text-property-any
+					(point-min) (point-max) 'hard 't)))
+			(fill-flowed-encode)
+			;; Indicate that `mml-insert-mime-headers' should
+			;; insert a "; format=flowed" string unless the
+			;; user has already specified it.
+			(setq flowed (null (assq 'format cont)))))
 		    (setq charset (mm-encode-body charset))
 		    (setq encoding (mm-body-encoding
 				    charset (cdr (assq 'encoding cont))))))
-		  ;; Only perform format=flowed filling on text/plain
-		  ;; parts where there either isn't a format parameter
-		  ;; in the mml tag or it says "flowed" and there
-		  ;; actually are hard newlines in the text.
-		  (let (use-hard-newlines)
-		    (when (and (string= type "text/plain")
-			       (or (null (assq 'format cont))
-				   (string= (cdr (assq 'format cont))
-					    "flowed"))
-			       (setq use-hard-newlines
-				     (text-property-any
-				      (point-min) (point-max) 'hard 't)))
-		      (fill-flowed-encode)
-		      ;; Indicate that `mml-insert-mime-headers' should
-		      ;; insert a "; format=flowed" string unless the
-		      ;; user has already specified it.
-		      (setq flowed (null (assq 'format cont)))))
 		  (setq coded (buffer-string)))
 		(mml-insert-mime-headers cont type charset encoding flowed)
 		(insert "\n")

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

* Re: Format=flowed & QP
  2002-10-03  2:28 Format=flowed & QP Jesper Harder
@ 2002-12-29 15:31 ` Lars Magne Ingebrigtsen
  2002-12-29 20:51   ` Jesper Harder
  0 siblings, 1 reply; 4+ messages in thread
From: Lars Magne Ingebrigtsen @ 2002-12-29 15:31 UTC (permalink / raw)


Jesper Harder <harder@ifa.au.dk> writes:

> I think the problem is that `fill-flowed-encode' is applied *after*
> QP-encoding (which I don't think is the right order).
>
> Reversing that order seems to fix it¹.

I've applied the patch.

> But maybe we shouldn't flow text at all unless the CTE is 8bit or
> 7bit?  (because QP supports soft linebreaks without f=f).

I'm a bit rusty in the QP area, but I can't seem to recall any soft
line breaks in QP...  Do you have a pointer?

-- 
(domestic pets only, the antidote for overdose, milk.)
   larsi@gnus.org * Lars Magne Ingebrigtsen



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

* Re: Format=flowed & QP
  2002-12-29 15:31 ` Lars Magne Ingebrigtsen
@ 2002-12-29 20:51   ` Jesper Harder
  2002-12-29 22:02     ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Jesper Harder @ 2002-12-29 20:51 UTC (permalink / raw)


Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> Jesper Harder <harder@ifa.au.dk> writes:
>
>> But maybe we shouldn't flow text at all unless the CTE is 8bit or
>> 7bit?  (because QP supports soft linebreaks without f=f).
>
> I'm a bit rusty in the QP area, but I can't seem to recall any soft
> line breaks in QP...  Do you have a pointer?

Well, it's not soft breaks in exactly the same sense as format=flowed.
But in QP "=" at EOL is called a soft line break.  RFC 2045 section 6.7:

    (5)   (Soft Line Breaks) The Quoted-Printable encoding
          REQUIRES that encoded lines be no more than 76
          characters long.  If longer lines are to be encoded
          with the Quoted-Printable encoding, "soft" line breaks
          must be used.  An equal sign as the last character on a
          encoded line indicates such a non-significant ("soft")
          line break in the encoded text.



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

* Re: Format=flowed & QP
  2002-12-29 20:51   ` Jesper Harder
@ 2002-12-29 22:02     ` Lars Magne Ingebrigtsen
  0 siblings, 0 replies; 4+ messages in thread
From: Lars Magne Ingebrigtsen @ 2002-12-29 22:02 UTC (permalink / raw)


Jesper Harder <harder@ifa.au.dk> writes:

> Well, it's not soft breaks in exactly the same sense as format=flowed.
> But in QP "=" at EOL is called a soft line break.  RFC 2045 section 6.7:
>
>     (5)   (Soft Line Breaks) The Quoted-Printable encoding
>           REQUIRES that encoded lines be no more than 76
>           characters long.  If longer lines are to be encoded
>           with the Quoted-Printable encoding, "soft" line breaks
>           must be used.  An equal sign as the last character on a
>           encoded line indicates such a non-significant ("soft")
>           line break in the encoded text.

Well, these aren't line breaks at all, really, just a way to encode
long lines for transfer using shorter lines.  Which is kinda the
opposite of what format=flowed does, isn't it?

-- 
(domestic pets only, the antidote for overdose, milk.)
   larsi@gnus.org * Lars Magne Ingebrigtsen



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

end of thread, other threads:[~2002-12-29 22:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-03  2:28 Format=flowed & QP Jesper Harder
2002-12-29 15:31 ` Lars Magne Ingebrigtsen
2002-12-29 20:51   ` Jesper Harder
2002-12-29 22:02     ` Lars Magne Ingebrigtsen

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