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: Robert Pluim
Subject: Re: emacs-26 8f18d12: Improve documentation of decoding into a unibyte buffer
Date: Mon, 27 May 2019 15:49:50 +0200

>>>>> On Mon, 27 May 2019 09:32:11 -0400, Stefan Monnier <address@hidden> said:
    >> If I take a string of say "β", and replace string-as-unibyte with
    >> (encode-coding-string 'emacs-internal), `encoded-string-description'
    >> prints "#xCE #xB2", which is the correct UTF-8 encoded
    >> value. 'raw-text works too. Iʼm certain that there are subtle
    >> differences between the two that I donʼt understand.

    Stefan> But "β" is not a "STR that is encoded by CODING-SYSTEM", so this 
output
    Stefan> is neither correct nor incorrect in any case.

It matches the current output of encoded-string-description, though.

    Stefan> I think the right thing to do here is one of:
    Stefan> - signal an error if `str` is multibyte.
    Stefan> - signal an error if `str` is multibyte and contains non-byte chars.
    Stefan> - if multibyte, encode `str` with `coding-system`.
    Stefan> - just don't bother looking at whether `str` is unibyte or not, just
    Stefan>   pass it as is to `mapconcat`.
    Stefan> - just don't bother looking at whether `str` is unibyte or not, just
    Stefan>   pass it as is to `mapconcat` but in the lambda, do catch the case
    Stefan>   where `x` is an "eight bit raw-byte char" and if so pass it to
    Stefan>   multibyte-char-to-unibyte.
    Stefan> - ...

Since this is the underlying code that displays the 'buffer code'
section of 'C-u C-x =', I donʼt think barfing on multibyte is the
right thing to do. Nor is passing it on as is.

    Stefan> But encoding `str` with any coding system like raw-text or
    Stefan> emacs-internal doesn't seem to make much sense.

Then what is the correct way to say 'give me the raw byte version
of this character'? (or maybe we should just let sleeping encodings
lie :-) )

Robert



reply via email to

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