[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: master d1c9310: DOn't use string-as-unibyte in Gnus
From: |
Andy Moreton |
Subject: |
Re: master d1c9310: DOn't use string-as-unibyte in Gnus |
Date: |
Wed, 01 Feb 2017 13:12:31 +0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (windows-nt) |
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 <address@hidden>
>> Commit: Lars Ingebrigtsen <address@hidden>
>
>> 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