From: Andy Moreton <andrewjmoreton@gmail.com>
To: emacs-devel@gnu.org
Subject: Re: master d1c9310: DOn't use string-as-unibyte in Gnus
Date: Wed, 01 Feb 2017 13:12:31 +0000 [thread overview]
Message-ID: <vz1poj2m4w0.fsf@gmail.com> (raw)
In-Reply-To: b4m4m0ecjsc.fsf@jpl.org
On Wed 01 Feb 2017, Katsumi Yamaoka wrote:
> Hi Lars,
>
> On Tue, 31 Jan 2017 16:58:08 +0000, Lars Ingebrigtsen wrote:
>> branch: master
>> commit d1c931009004aef847105b7bac6b6ffafd985b82
>> Author: Lars Ingebrigtsen <larsi@gnus.org>
>> Commit: Lars Ingebrigtsen <larsi@gnus.org>
>
>> DOn't use string-as-unibyte in Gnus
> [...]
>> * lisp/gnus/mml.el (mml-generate-mime-1): Ditto.
> [...]
>> --- a/lisp/gnus/mml.el
>> +++ b/lisp/gnus/mml.el
>> @@ -696,9 +696,10 @@ be \"related\" or \"alternate\"."
>> (set-buffer-multibyte nil)
>> (cond
>> ((cdr (assq 'buffer cont))
>> - (insert (string-as-unibyte
>> + (insert (encode-coding-string
>> (with-current-buffer (cdr (assq 'buffer cont))
>> - (buffer-string)))))
>> + (buffer-string))
>> + 'utf-8)))
>> ((and filename
>> (not (equal (cdr (assq 'nofile cont)) "yes")))
>> (let ((coding-system-for-read mm-binary-coding-system))
>
> This change breaks a jpeg image (at least). Recipe:
>
> ・Visit an image file using `universal-coding-system-argument'
> with `binary' and `find-file', i.e.:
> C-x RET c binary RET C-x C-f FILENAME RET C-c C-c
> ・Open a message draft.
> ・Insert this mml tag:
>
> <#part type="image/jpeg" disposition=inline buffer="IMAGE">
>
> Where "IMAGE" is the buffer name that visits the image file.
> ・Preview it by `C-c RET P' or send it by `C-c C-c'.
>
> This means that a warning often seen recently
>
> ‘string-as-unibyte’ is an obsolete function (as of
> 26.1); use ‘encode-coding-string’.
>
> does not say the truth, does it?
I think that 'utf-8 (a variable length encoding) is wrong here, and that
the coding system should be 'binary. That seems to fix the image
corruption seen in the preview when following the recipe.
AndyM
next prev parent reply other threads:[~2017-02-01 13:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20170131165808.28198.10570@vcs.savannah.gnu.org>
[not found] ` <20170131165808.9F18722015F@vcs.savannah.gnu.org>
2017-02-01 10:00 ` master d1c9310: DOn't use string-as-unibyte in Gnus Katsumi Yamaoka
2017-02-01 10:20 ` Katsumi Yamaoka
2017-02-01 10:24 ` Andreas Schwab
2017-02-01 12:47 ` Lars Ingebrigtsen
2017-02-01 13:12 ` Andy Moreton [this message]
2017-02-01 15:35 ` Eli Zaretskii
2017-02-01 16:07 ` Andy Moreton
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=vz1poj2m4w0.fsf@gmail.com \
--to=andrewjmoreton@gmail.com \
--cc=emacs-devel@gnu.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.