GNU bug report logs - #25420
Unknown encoding 8bit;; defaulting to 8bit

Previous Next

Package: emacs;

Reported by: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>

Date: Wed, 11 Jan 2017 16:46:01 UTC

Severity: minor

Done: Katsumi Yamaoka <yamaoka <at> jpl.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 25420 in the body.
You can then email your comments to 25420 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#25420; Package emacs. (Wed, 11 Jan 2017 16:46:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 11 Jan 2017 16:46:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
To: Katsumi Yamaoka <yamaoka <at> jpl.org>
Cc: bug-gnu-emacs <at> gnu.org
Subject: Unknown encoding 8bit;; defaulting to 8bit
Date: Thu, 12 Jan 2017 00:44:28 +0800
OK I'm sending it to them.

Dear bug-gnu-emacs:

>>>>> "KY" == Katsumi Yamaoka <yamaoka <at> jpl.org> writes:
KY> On Wed, 11 Jan 2017 08:39:21 +0800, 積丹尼さん wrote:
>> [1. application/gzip; smsc.cpio.gz]...

KY> Thanks.  I could reproduce the problem; a workaround is below.
KY> Feel free to forward this reply to the Emacs bug list or other.

KY> (defadvice ietf-drums-strip (after remove-garbage activate)
KY>   "Remove garbage."
KY>   (let ((regexp (concat "[" ietf-drums-tspecials "]+")))
KY>     (while (string-match regexp ad-return-value)
KY>       (setq ad-return-value
KY> 	    (concat (substring ad-return-value 0 (match-beginning 0))
KY> 		    (substring ad-return-value (match-end 0)))))))

KY> A mail that contains this header

KY> 	Content-Transfer-Encoding: 8bit;

KY> causes Gnus to issue the following warning:

KY> 	Unknown encoding 8bit;; defaulting to 8bit

KY> This means that Gnus doesn't know the encoding method named:

KY> 8bit;

KY> Note that this is not "8bit", but "8bit;".  This is due to a bug
KY> of a certain mail software.  Gnus does no bad.  But it is easy
KY> and harmless to make Gnus fix it, so, I think we had better do
KY> something like the above workaround if it generally happens.
KY> I'm not quite sure whether using `ietf-drums-tspecials' is the
KY> right choice, though.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25420; Package emacs. (Thu, 12 Jan 2017 00:08:01 GMT) Full text and rfc822 format available.

Message #8 received at 25420 <at> debbugs.gnu.org (full text, mbox):

From: Katsumi Yamaoka <yamaoka <at> jpl.org>
To: 25420 <at> debbugs.gnu.org
Cc: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Subject: Re: bug#25420: Unknown encoding 8bit;; defaulting to 8bit
Date: Thu, 12 Jan 2017 09:07:43 +0900
[Message part 1 (text/plain, inline)]
On Thu, 12 Jan 2017 00:44:28 +0800, 積丹尼 Dan Jacobson 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,
[Message part 2 (text/x-patch, 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)

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25420; Package emacs. (Thu, 12 Jan 2017 23:52:01 GMT) Full text and rfc822 format available.

Message #11 received at 25420 <at> debbugs.gnu.org (full text, mbox):

From: Katsumi Yamaoka <yamaoka <at> jpl.org>
To: 25420 <at> debbugs.gnu.org
Cc: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Subject: Re: bug#25420: Unknown encoding 8bit;; defaulting to 8bit
Date: Fri, 13 Jan 2017 08:51:09 +0900
On Thu, 12 Jan 2017 09:07:43 +0900, Katsumi Yamaoka wrote:
> On Thu, 12 Jan 2017 00:44:28 +0800, 積丹尼 Dan Jacobson 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;".
[...]
> A partial[1] patch is below.

Installed:
<http://lists.gnu.org/archive/html/emacs-diffs/2017-01/msg00089.html>




bug closed, send any further explanations to 25420 <at> debbugs.gnu.org and 積丹尼 Dan Jacobson <jidanni <at> jidanni.org> Request was from Katsumi Yamaoka <yamaoka <at> jpl.org> to control <at> debbugs.gnu.org. (Fri, 13 Jan 2017 08:26:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 10 Feb 2017 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 8 years and 182 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.