From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Andy Moreton Newsgroups: gmane.emacs.devel Subject: Re: master d1c9310: DOn't use string-as-unibyte in Gnus Date: Wed, 01 Feb 2017 13:12:31 +0000 Message-ID: References: <20170131165808.28198.10570@vcs.savannah.gnu.org> <20170131165808.9F18722015F@vcs.savannah.gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1485955327 8664 195.159.176.226 (1 Feb 2017 13:22:07 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 1 Feb 2017 13:22:07 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (windows-nt) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Feb 01 14:22:03 2017 Return-path: Envelope-to: ged-emacs-devel@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 1cYurK-00020q-Pe for ged-emacs-devel@m.gmane.org; Wed, 01 Feb 2017 14:22:02 +0100 Original-Received: from localhost ([::1]:50845 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cYurO-00077q-PB for ged-emacs-devel@m.gmane.org; Wed, 01 Feb 2017 08:22:07 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36878) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cYuiN-0006PH-LJ for emacs-devel@gnu.org; Wed, 01 Feb 2017 08:12:51 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cYuiI-0003nA-Jh for emacs-devel@gnu.org; Wed, 01 Feb 2017 08:12:47 -0500 Original-Received: from [195.159.176.226] (port=33874 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cYuiI-0003mx-Bm for emacs-devel@gnu.org; Wed, 01 Feb 2017 08:12:42 -0500 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1cYuiA-0004G1-NL for emacs-devel@gnu.org; Wed, 01 Feb 2017 14:12:34 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 56 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:E0TJ57ICbsu/OmQMRFD3oQlJALE= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:211841 Archived-At: 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 >> Commit: Lars Ingebrigtsen > >> 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