[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: `write-region' writes different bytes than passed to it?
From: |
Eli Zaretskii |
Subject: |
Re: `write-region' writes different bytes than passed to it? |
Date: |
Sun, 10 Feb 2019 22:13:45 +0200 |
> From: Philipp Stephani <p.stephani2@gmail.com>
> Date: Sun, 10 Feb 2019 20:15:57 +0100
> Cc: help-gnu-emacs <help-gnu-emacs@gnu.org>
>
> > > There are two easy cases:
> > > 1. STRING is a unibyte string containing only bytes within the ASCII range
> > > 2. STRING is a multibyte string containing only Unicode scalar values
> > > In those cases the answer is simple: The form writes the UTF-8
> > > representation of STRING.
> >
> > Not sure what you mean by "unicode scalar values"
>
> What the Unicode standard says :)
A multibyte Unicode string doesn't contain Unicode scalar values, it
contains their UTF-8 encoding.
> To recap: An Emacs Lisp multibyte string is a sequence of integers of
> a certain range.
No, it's a sequence of bytes that can be interpreted as representing a
sequence of integers.
> > Maybe we should just drop support for coding systems that aren't
> > supersets of ASCII and be done with it, but I'm not sure we're ready to
> > do that.
>
> That might be one option.
Just a month or two ago someone asked about one variation of EBCDIC
that we didn't support directly. So no, it's too early to drop them.
> 1. Signal an error whenever Emacs attempts to encode a unibyte string
> and the encoding isn't "raw-text" or "no-conversion"
> 2. Like (1), but only signal an error if the encoding isn't ASCII-compatible
Signaling an error in these cases is a non-starter. If you don't like
what Emacs does in these cases, just don't write such code. Emacs is
not a tool whose primary goal is educating novice programmers, it is
also an industry-strength system that allows doing low-level stuff
when needed. If we signal errors in those cases, we will throw out
valid use cases for no good reason.
- Re: `write-region' writes different bytes than passed to it?, Philipp Stephani, 2019/02/10
- Re: `write-region' writes different bytes than passed to it?, Philipp Stephani, 2019/02/10
- Re: `write-region' writes different bytes than passed to it?,
Eli Zaretskii <=
- Re: `write-region' writes different bytes than passed to it?, Stefan Monnier, 2019/02/10
- Re: `write-region' writes different bytes than passed to it?, Eli Zaretskii, 2019/02/10
- Re: `write-region' writes different bytes than passed to it?, Stefan Monnier, 2019/02/11
- Re: `write-region' writes different bytes than passed to it?, Eli Zaretskii, 2019/02/11
- Re: `write-region' writes different bytes than passed to it?, Stefan Monnier, 2019/02/11
- Re: `write-region' writes different bytes than passed to it?, Eli Zaretskii, 2019/02/11
- Re: `write-region' writes different bytes than passed to it?, Stefan Monnier, 2019/02/11