From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Katsumi Yamaoka Newsgroups: gmane.emacs.bugs Subject: bug#25420: Unknown encoding 8bit;; defaulting to 8bit Date: Thu, 12 Jan 2017 09:07:43 +0900 Organization: Emacsen advocacy group Message-ID: References: <87vatpx9aq.fsf@jidanni.org> <87mvexzgur.fsf@jidanni.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1484179709 18011 195.159.176.226 (12 Jan 2017 00:08:29 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 12 Jan 2017 00:08:29 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (i686-pc-cygwin) Cc: =?UTF-8?Q?=E7=A9=8D=E4=B8=B9=E5=B0=BC?= Dan Jacobson To: 25420@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jan 12 01:08:21 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cRSw5-0002sH-R1 for geb-bug-gnu-emacs@m.gmane.org; Thu, 12 Jan 2017 01:08:10 +0100 Original-Received: from localhost ([::1]:58312 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cRSw8-0008B2-MM for geb-bug-gnu-emacs@m.gmane.org; Wed, 11 Jan 2017 19:08:12 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51643) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cRSw2-0008Ak-A7 for bug-gnu-emacs@gnu.org; Wed, 11 Jan 2017 19:08:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cRSvy-0007Wf-A1 for bug-gnu-emacs@gnu.org; Wed, 11 Jan 2017 19:08:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:35162) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cRSvy-0007Wb-6O for bug-gnu-emacs@gnu.org; Wed, 11 Jan 2017 19:08:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cRSvx-0005B0-PY for bug-gnu-emacs@gnu.org; Wed, 11 Jan 2017 19:08:01 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: <87mvexzgur.fsf@jidanni.org> Resent-From: Katsumi Yamaoka Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 12 Jan 2017 00:08:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25420 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 25420-submit@debbugs.gnu.org id=B25420.148417967719883 (code B ref 25420); Thu, 12 Jan 2017 00:08:01 +0000 Original-Received: (at 25420) by debbugs.gnu.org; 12 Jan 2017 00:07:57 +0000 Original-Received: from localhost ([127.0.0.1]:50561 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cRSvs-0005Ad-V1 for submit@debbugs.gnu.org; Wed, 11 Jan 2017 19:07:57 -0500 Original-Received: from mail-hampton.hostforweb.net ([205.234.186.191]:42611 helo=hampton.hostforweb.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cRSvr-0005AP-HC for 25420@debbugs.gnu.org; Wed, 11 Jan 2017 19:07:55 -0500 Original-Received: from s70.gtokyofl21.vectant.ne.jp ([202.215.75.70]:60000 helo=localhost) by hampton.hostforweb.net with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.87) (envelope-from ) id 1cRSvj-000IvO-R6; Wed, 11 Jan 2017 18:07:49 -0600 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&( Cancel-Lock: sha1:nbQPrVrjgubm1e7U1OuiFoYLMao= X-OutGoing-Spam-Status: No, score=-2.9 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - hampton.hostforweb.net X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - jpl.org X-Get-Message-Sender-Via: hampton.hostforweb.net: authenticated_id: yamaoka/from_h X-Authenticated-Sender: hampton.hostforweb.net: yamaoka@jpl.org X-Source: X-Source-Args: X-Source-Dir: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:128025 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Thu, 12 Jan 2017 00:44:28 +0800, =E7=A9=8D=E4=B8=B9=E5=B0=BC Dan Jacobso= n wrote: > A mail that contains this header > Content-Transfer-Encoding: 8bit; > causes Gnus to issue the following warning: > Unknown encoding 8bit;; defaulting to 8bit > This means that Gnus doesn't know the encoding method named: > 8bit; > Note that this is not "8bit", but "8bit;". I found it in a mail that Dan Jacobson sent to me as an example. > This is due to a bug of a certain mail software. Gnus does no bad. > But it is easy and harmless to make Gnus fix it, so, I think we had > better do something like the above workaround if it generally happens. A partial[1] patch is below. `ietf-drums-strip' is an aliasee of `mail-header-strip' that the following modules use in Emacs: lisp/gnus/gnus-art.el lisp/gnus/gnus-sum.el lisp/gnus/mm-decode.el lisp/gnus/nndoc.el lisp/mh-e/mh-mime.el The purpose of it is all to clean up a string value of the Content-Transfer-Encoding header of a mail. So, we can make `ietf-drums-strip' remove some garbage, such as ";", in addition to comments and whitespace. However, other programs outside of Emacs might be using it for different purposes. This is why I added the new function `mail-header-strip-cte' that is assumed to be exclusively used for cleaning up C-T-E string. [1] When I install the patch, I will replace `mail-header-strip' in the modules listed above with `mail-header-strip-cte' as well. Regards, --=-=-= Content-Type: text/x-patch Content-Disposition: inline --- lisp/mail/ietf-drums.el~ 2017-01-04 22:16:46 +0000 +++ lisp/mail/ietf-drums.el 2017-01-11 23:18:33 +0000 @@ -171,8 +171,21 @@ (defun ietf-drums-strip (string) "Remove comments and whitespace from STRING." (ietf-drums-remove-whitespace (ietf-drums-remove-comments string))) +(defun ietf-drums-remove-garbage (string) + "Remove some gabage from STRING." + (while (string-match "[][()<>@,;:\\\"/?=]+" string) + (setq string (concat (substring string 0 (match-beginning 0)) + (substring string (match-end 0))))) + string) + +(defun ietf-drums-strip-cte (string) + "Remove comments, whitespace and gabage from STRING. +STRING is assumed to be a string that is extracted from +the Content-Transfer-Encoding header of a mail." + (ietf-drums-remove-garbage (inline (ietf-drums-strip string)))) + (defun ietf-drums-parse-address (string) "Parse STRING and return a MAILBOX / DISPLAY-NAME pair." (with-temp-buffer (let (display-name mailbox c display-string) --- lisp/mail/mail-parse.el~ 2017-01-04 22:16:46 +0000 +++ lisp/mail/mail-parse.el 2017-01-11 23:13:51 +0000 @@ -51,2 +51,3 @@ (defalias 'mail-header-strip 'ietf-drums-strip) +(defalias 'mail-header-strip-cte 'ietf-drums-strip-cte) (defalias 'mail-header-get-comment 'ietf-drums-get-comment) --=-=-=--