Gnus development mailing list
 help / color / mirror / Atom feed
From: Katsumi Yamaoka <yamaoka@jpl.org>
To: ding@gnus.org
Subject: Re: More liberal MIME decoding (unencoded question marks in encoded words)
Date: Mon, 26 Nov 2007 21:31:46 +0900	[thread overview]
Message-ID: <b4m3autchn1.fsf@jpl.org> (raw)
In-Reply-To: <v963zrepqc.fsf@marauder.physik.uni-ulm.de>

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

>>>>> Reiner Steib wrote:

> I see more an more incorrectly encoded subjects like this:

> ,----
>| Subject: =?ISO-8859-1?Q?bequeme_Index-Eintr=E4ge_mit_TexnicCenter??=
>| Organization: http://groups.google.com
>| Message-ID: <78a8858d-463a-4a24-b18c-d0579ef60be9@s19g2000prg.googlegroups.com>
>| User-Agent: G2/1.0
> `----

> 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 but we must check it thoroughly.
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"
...

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

--- rfc2047.el~	2007-10-04 21:53:36 +0000
+++ rfc2047.el	2007-11-26 12:25:07 +0000
@@ -827,8 +827,10 @@
 
 (eval-and-compile
   (defconst rfc2047-encoded-word-regexp
-    "=\\?\\([^][\000-\040()<>@,\;:*\\\"/?.=]+\\)\\(?:\\*[^?]+\\)?\
-\\?\\(B\\|Q\\)\\?\\([!->@-~ ]*\\)\\?="))
+    "=\\?\\([^][\000-\040()<>@,\;:*\\\"/?.=]+\\)\\(?:\\*[^?]+\\)?\\?\
+\\(B\\?[+/0-9A-Za-z]*=*\
+\\|Q\\?\\(?:\\?+[ -<>@-~]\\)?\\(?:[ ->@-~]+\\?+[ -<>@-~]\\)*[ ->@-~]*\\?*\
+\\)\\?="))
 
 (defvar rfc2047-quote-decoded-words-containing-tspecials nil
   "If non-nil, quote decoded words containing special characters.")
@@ -967,7 +969,7 @@
 	  (while match
 	    (push (list (match-string 2) ;; charset
 			(char-after (match-beginning 3)) ;; encoding
-			(match-string 4) ;; encoded-text
+			(substring (match-string 3) 2) ;; encoded-text
 			(match-string 1)) ;; encoded-word
 		  words)
 	    ;; Look for the subsequent encoded-words.

  reply	other threads:[~2007-11-26 12:31 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 [this message]
2007-11-26 22:08   ` Reiner Steib
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=b4m3autchn1.fsf@jpl.org \
    --to=yamaoka@jpl.org \
    --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).