From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/65869 Path: news.gmane.org!not-for-mail From: Katsumi Yamaoka Newsgroups: gmane.emacs.gnus.general Subject: Re: More liberal MIME decoding (unencoded question marks in encoded words) Date: Tue, 04 Dec 2007 18:19:51 +0900 Organization: Emacsen advocacy group Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1196760024 30572 80.91.229.12 (4 Dec 2007 09:20:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 4 Dec 2007 09:20:24 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M14364@lists.math.uh.edu Tue Dec 04 10:20:34 2007 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.50) id 1IzTxB-00081X-AG for ding-account@gmane.org; Tue, 04 Dec 2007 10:20:33 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1IzTwq-00054o-9P; Tue, 04 Dec 2007 03:20:12 -0600 Original-Received: from mx2.math.uh.edu ([129.7.128.33]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1IzTwp-00054c-2z for ding@lists.math.uh.edu; Tue, 04 Dec 2007 03:20:11 -0600 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx2.math.uh.edu with esmtp (Exim 4.67) (envelope-from ) id 1IzTwi-0003qq-LR for ding@lists.math.uh.edu; Tue, 04 Dec 2007 03:20:10 -0600 Original-Received: from orlando.hostforweb.net ([216.246.45.90]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1IzTwf-0002zw-00 for ; Tue, 04 Dec 2007 10:20:01 +0100 Original-Received: from [66.225.201.151] (port=37430 helo=mail.jpl.org) by orlando.hostforweb.net with esmtpa (Exim 4.68) (envelope-from ) id 1IzTwZ-0000Sz-Hn for ding@gnus.org; Tue, 04 Dec 2007 03:19:56 -0600 X-Hashcash: 1:20:071204:ding@gnus.org::Jm0hjFrUHG0t9A1a:00001ppS X-Face: #kKnN,xUnmKia.'[pp`;Omh}odZK)?7wQSl"4o04=EixTF+V[""w~iNbM9ZL+.b*_CxUmFk B#Fu[*?MZZH@IkN:!"\w%I_zt>[$nm7nQosZ<3eu;B:$Q_:p!',P.c0-_Cy[dz4oIpw0ESA^D*1Lw= L&i*6&( User-Agent: Gnus/5.110007 (No Gnus v0.7) Emacs/23.0.50 (gnu/linux) Cancel-Lock: sha1:Ky1i+tyCvxC4OwE+vkFcrRH3Cj8= X-Antivirus-Scanner: Clean mail though you should still use an Antivirus X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - orlando.hostforweb.net X-AntiAbuse: Original Domain - gnus.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - jpl.org X-Source: X-Source-Args: X-Source-Dir: X-Spam-Score: -2.4 (--) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:65869 Archived-At: >>>>> Reiner Steib wrote: >>> On Mon, Nov 26 2007, Katsumi Yamaoka wrote: >>>> Would we be able to make complete test cases? > I don't think providing *complete* test cases is possible. But > regression tests would be very nice to have. > How about defining a variable containing list of (decoded . encoded) > pairs, decode/encode the strings and put the results in a buffer (or > file) and compare them? That's a good idea. Since rfc2047.el does some special treatments, it will be a good means not only for the test but also for explaining them. However, though I've faced various instances causing troubles while improving rfc2047.el, to my regret I lost all of them. I'll scan my articles archived and functions when I have time in the future. >>> +\\|Q\\?\\(?:\\?+[ -<>@-~]\\)?\\(?:[ ->@-~]+\\?+[ -<>@-~]\\)*[ ->@-~]*\\?*\ >>> +\\)\\?=")) [...] > Could you please add such explanations as comments in `rfc2047.el'? Done. [...] > I see that we already have quite a few of these variables: At least > `rfc2047-allow-irregular-q-encoded-words', > `rfc2047-allow-incomplete-encoded-text' and finally > `gnus-article-loose-mime'. > How about deriving the defaults from a single variable > `rfc2047-allow-loose-mime' (or `rfc2047-loose-mime-decoding'): > (defcustom rfc2047-allow-loose-mime t > "Allow loose MIME decoding. ...") > (devar rfc2047-allow-irregular-q-encoded-words rfc2047-allow-loose-mime > ...) > (devar rfc2047-allow-incomplete-encoded-text rfc2047-allow-loose-mime > ...) > (defcustom gnus-article-loose-mime rfc2047-allow-loose-mime > "... > See also `rfc2047-allow-loose-mime'.") > Or even, if we don't need such a fine tuning, use > `rfc2047-allow-loose-mime' directly. I agree with integrating those options into the only `rfc2047-allow-loose-mime'. However, for `gnus-article-loose-mime', I don't think making it refer to the rfc2047- variable is proper because rfc2047 is not necessarily a representative for the MIME features. Needless to say, making rfc2047.el refer to the value of `gnus-article-loose-mime' is bad, too. Also (gnus|mm|gmm)-utils.el seem not to be a good place to define MIME- related things. Hmm, I have no good idea. >> Now there are two regexps; one is `rfc2047-encoded-word-regexp' for >> strict decoding, the other is `rfc2047-encoded-word-regexp-loose'. > You you explain the purpose of using `eval-and-compile'? Because those values are the constants and the values derived from them are hard coded in `rfc2047-decode-region'. Without `eval-and-compile' Emacs complains as: Error: Symbol's value as variable is void: rfc2047-encoded-word-regexp-loose There might be room for considering whether they should be constants or not, though. > The defconst needs to be before `rfc2047-encodable-p': > In rfc2047-encodable-p: > rfc2047.el:302:37:Warning: reference to free variable > `rfc2047-encoded-word-regexp' Fixed. I didn't notice it until I tried compiling rfc2047.el individually. Thanks.