all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Katsumi Yamaoka <yamaoka@jpl.org>
To: 25420@debbugs.gnu.org
Cc: "積丹尼 Dan Jacobson" <jidanni@jidanni.org>
Subject: bug#25420: Unknown encoding 8bit;; defaulting to 8bit
Date: Thu, 12 Jan 2017 09:07:43 +0900	[thread overview]
Message-ID: <b4mbmvdcf8w.fsf@jpl.org> (raw)
In-Reply-To: <87mvexzgur.fsf@jidanni.org>

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

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,

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

--- 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)

  reply	other threads:[~2017-01-12  0:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87vatpx9aq.fsf@jidanni.org>
2017-01-11 16:44 ` bug#25420: Unknown encoding 8bit;; defaulting to 8bit 積丹尼 Dan Jacobson
2017-01-12  0:07   ` Katsumi Yamaoka [this message]
2017-01-12 23:51     ` 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=b4mbmvdcf8w.fsf@jpl.org \
    --to=yamaoka@jpl.org \
    --cc=25420@debbugs.gnu.org \
    --cc=jidanni@jidanni.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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.