unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: master 0d7d09b: Test for error with multibyte strings in bindat.el
       [not found] ` <20201022132028.35E5C209D4@vcs0.savannah.gnu.org>
@ 2020-10-22 15:32   ` Stefan Monnier
  2020-10-22 16:10     ` Stefan Kangas
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2020-10-22 15:32 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: emacs-devel

> +  (should-error (bindat-pack nil nil (decode-coding-string "ö" 'utf-8))))

I don't understand this code: "ö" is a multibyte string,
i.e. a sequence of chars (and not a sequence of bytes), so you can
"encode" it to a sequence of bytes but "decoding" it makes no sense
(and should ideally signal an error, tho I think we currently refrain
from doing so).


        Stefan




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

* Re: master 0d7d09b: Test for error with multibyte strings in bindat.el
  2020-10-22 15:32   ` master 0d7d09b: Test for error with multibyte strings in bindat.el Stefan Monnier
@ 2020-10-22 16:10     ` Stefan Kangas
  2020-10-22 16:44       ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Kangas @ 2020-10-22 16:10 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> +  (should-error (bindat-pack nil nil (encode-coding-string "ö" 'utf-8))))
>
> I don't understand this code: "ö" is a multibyte string,
> i.e. a sequence of chars (and not a sequence of bytes), so you can
> "encode" it to a sequence of bytes but "decoding" it makes no sense
> (and should ideally signal an error, tho I think we currently refrain
> from doing so).

Ugh, sorry about that.  I guess the fix is to just change this to:

  (should-error (bindat-pack nil nil "ö"))

Correct?



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

* Re: master 0d7d09b: Test for error with multibyte strings in bindat.el
  2020-10-22 16:10     ` Stefan Kangas
@ 2020-10-22 16:44       ` Stefan Monnier
  0 siblings, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2020-10-22 16:44 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: emacs-devel

> Ugh, sorry about that.  I guess the fix is to just change this to:
>
>   (should-error (bindat-pack nil nil "ö"))
>
> Correct?

That works for me, yes,



        Stefan




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

end of thread, other threads:[~2020-10-22 16:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20201022132026.11259.71984@vcs0.savannah.gnu.org>
     [not found] ` <20201022132028.35E5C209D4@vcs0.savannah.gnu.org>
2020-10-22 15:32   ` master 0d7d09b: Test for error with multibyte strings in bindat.el Stefan Monnier
2020-10-22 16:10     ` Stefan Kangas
2020-10-22 16:44       ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).