Gnus development mailing list
 help / color / mirror / Atom feed
From: Reiner Steib <reinersteib+gmane@imap.cc>
To: ding@gnus.org
Subject: Re: More liberal MIME decoding (unencoded question marks in encoded words)
Date: Mon, 26 Nov 2007 23:08:30 +0100	[thread overview]
Message-ID: <v9y7ckoe1t.fsf@marauder.physik.uni-ulm.de> (raw)
In-Reply-To: <b4m3autchn1.fsf@jpl.org>

On Mon, Nov 26 2007, Katsumi Yamaoka wrote:

>>>>>> Reiner Steib wrote:
>> The mistake on Google's side is not to encode the (trailing) question
>> mark.  How can we make Gnus' decoder more liberal?
>
> Maybe the patch below does it

Thanks.

> but we must check it thoroughly.

Agreed.

> Would we be able to make complete test cases?
>
> (rfc2047-decode-string "=?ISO-8859-1?Q??foo?=")
> "?foo"
> (rfc2047-decode-string "=?ISO-8859-1?Q?=foo?=")
> "=foo"
> (rfc2047-decode-string "=?ISO-8859-1?Q?foo??=")
> "foo?"
> (rfc2047-decode-string "=?ISO-8859-1?Q?foo?=?=")
> "foo?="
> (rfc2047-decode-string "=?ISO-8859-1?Q?foo?==?ISO-8859-1?Q?bar?=")
> "foobar"

Do you see the other examples often in the wild?  If not, I'd rather
not make the decode too liberal.  And we probably should have an
option to toggle strict/loose decoding.

BTW, another problem is that we "double encode"
(`rfc2047-encode-encoded-words') such subjects:

ELISP> (rfc2047-decode-string "=?ISO-8859-1?Q?foo??=")
"=?ISO-8859-1?Q?foo??="
ELISP> (rfc2047-encode-string "=?ISO-8859-1?Q?foo??=")
"=?us-ascii?Q?=3D=3FISO-8859-1=3FQ=3Ffoo=3F=3F=3D?="

AFAICS, Gnus (`rfc2047-encodable-p'?) simply looks for "=?".  When
found, the string is (double) encoded.  I'm not sure if this behavior
is wrong, but RFC2047 says the an encoded word is...


,----[ RFC2047 ]
|    Generally, an "encoded-word" is a sequence of printable ASCII
|    characters that begins with "=?", ends with "?=", and has two "?"s in
|    between.  It specifies a character set and an encoding method, and
|    also includes the original text encoded as graphic ASCII characters,
|    according to the rules for that encoding method.
`----

..., i.e. shouldn't we use "=\\?.+\\?[qb]\\?.+\\?=" (or similar)
instead of "=?"?

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/




  reply	other threads:[~2007-11-26 22:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-24 13:29 Reiner Steib
2007-11-26 12:31 ` Katsumi Yamaoka
2007-11-26 22:08   ` Reiner Steib [this message]
2007-11-27  9:34     ` Katsumi Yamaoka
2007-12-01 13:17       ` Reiner Steib
2007-12-04  9:19         ` 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=v9y7ckoe1t.fsf@marauder.physik.uni-ulm.de \
    --to=reinersteib+gmane@imap.cc \
    --cc=Reiner.Steib@gmx.de \
    --cc=ding@gnus.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).