all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re: master d1c9310: DOn't use string-as-unibyte in Gnus
       [not found] ` <20170131165808.9F18722015F@vcs.savannah.gnu.org>
@ 2017-02-01 10:00   ` Katsumi Yamaoka
  2017-02-01 10:20     ` Katsumi Yamaoka
                       ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Katsumi Yamaoka @ 2017-02-01 10:00 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: emacs-devel

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?

Thanks.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: master d1c9310: DOn't use string-as-unibyte in Gnus
  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
                       ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Katsumi Yamaoka @ 2017-02-01 10:20 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: emacs-devel

On Wed, 01 Feb 2017 19:00:51 +0900, Katsumi Yamaoka wrote:
> 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?

Sorry, I was wrong.  The problem seems to be due to encoding
a binary string.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: master d1c9310: DOn't use string-as-unibyte in Gnus
  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
  3 siblings, 0 replies; 7+ messages in thread
From: Andreas Schwab @ 2017-02-01 10:24 UTC (permalink / raw)
  To: Katsumi Yamaoka; +Cc: Lars Ingebrigtsen, emacs-devel

On Feb 01 2017, Katsumi Yamaoka <yamaoka@jpl.org> 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)))

Shouldn't that be raw-text?

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: master d1c9310: DOn't use string-as-unibyte in Gnus
  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
  3 siblings, 0 replies; 7+ messages in thread
From: Lars Ingebrigtsen @ 2017-02-01 12:47 UTC (permalink / raw)
  To: Katsumi Yamaoka; +Cc: emacs-devel

Katsumi Yamaoka <yamaoka@jpl.org> writes:

> This change breaks a jpeg image (at least).  Recipe:

Hm; I'll revert the patch.  I think I need to consider each case more
closely than I did when I made the changes yesterday...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: master d1c9310: DOn't use string-as-unibyte in Gnus
  2017-02-01 10:00   ` master d1c9310: DOn't use string-as-unibyte in Gnus Katsumi Yamaoka
                       ` (2 preceding siblings ...)
  2017-02-01 12:47     ` Lars Ingebrigtsen
@ 2017-02-01 13:12     ` Andy Moreton
  2017-02-01 15:35       ` Eli Zaretskii
  3 siblings, 1 reply; 7+ messages in thread
From: Andy Moreton @ 2017-02-01 13:12 UTC (permalink / raw)
  To: emacs-devel

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





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: master d1c9310: DOn't use string-as-unibyte in Gnus
  2017-02-01 13:12     ` Andy Moreton
@ 2017-02-01 15:35       ` Eli Zaretskii
  2017-02-01 16:07         ` Andy Moreton
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2017-02-01 15:35 UTC (permalink / raw)
  To: Andy Moreton; +Cc: emacs-devel

> From: Andy Moreton <andrewjmoreton@gmail.com>
> Date: Wed, 01 Feb 2017 13:12:31 +0000
> 
> 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.

I think Andreas is right, and raw-text is a better choice here.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: master d1c9310: DOn't use string-as-unibyte in Gnus
  2017-02-01 15:35       ` Eli Zaretskii
@ 2017-02-01 16:07         ` Andy Moreton
  0 siblings, 0 replies; 7+ messages in thread
From: Andy Moreton @ 2017-02-01 16:07 UTC (permalink / raw)
  To: emacs-devel

On Wed 01 Feb 2017, Eli Zaretskii wrote:

>> From: Andy Moreton <andrewjmoreton@gmail.com>
>> Date: Wed, 01 Feb 2017 13:12:31 +0000
>> 
>> 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.
>
> I think Andreas is right, and raw-text is a better choice here.

Agreed - I read his reply just after posting.

    AndyM




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-02-01 16:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [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
2017-02-01 15:35       ` Eli Zaretskii
2017-02-01 16:07         ` Andy Moreton

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.