emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: emacs-26 8f18d12: Improve documentation of decoding into a unibyte b


From: Eli Zaretskii
Subject: Re: emacs-26 8f18d12: Improve documentation of decoding into a unibyte buffer
Date: Tue, 28 May 2019 22:35:44 +0300

> Date: Tue, 28 May 2019 21:58:03 +0300
> From: Eli Zaretskii <address@hidden>
> Cc: address@hidden
> 
> > From: Stefan Monnier <address@hidden>
> > Cc: address@hidden
> > Date: Tue, 28 May 2019 13:43:47 -0400
> > 
> > >   (let* ((str1 (string-as-multibyte (string char)))
> > >    (str2 (string-as-multibyte (string char char)))
> > 
> > Why on earth do we call string-as-multibyte here?  AFAIK, the only cases
> > where `string` returns a unibyte string is when char <128 (it could make
> > sense to also do that for char ≥128 and <160, but we don't seem to do
> > that currently) and these are better turned into multibyte via
> > string-TO-unibyte (tho here we don't even need that, since the unibyte
> > string works just as well for what we do) than string-AS-unibyte.
> > 
> > I think this is an error.  The patch below seems in order.
> 
> I'm not sure.  Be sure to read the comments about the tricky business
> of this function, and the method it employs to solve it, and be sure
> you understand all of the subtleties there.

Btw, that function has a bug:

  (encode-coding-char ?a 'ebcdic-us) => "a"

It assumes that any ASCII character is encoded into itself, i.e. that
every coding-system is ASCII-compatible, which is false.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]