GNU bug report logs -
#12925
24.1; string-make-unibyte instead of string-as-unibyte
Previous Next
Full log
Message #14 received at 12925 <at> debbugs.gnu.org (full text, mbox):
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Date: Tue, 01 Jun 2021 09:02:13 +0200
> Cc: 12925 <at> debbugs.gnu.org, Ethan Glasser-Camp <ethan.glasser.camp <at> gmail.com>
>
> Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
>
> >> Why does inserting multibyte text into a unibyte buffer corrupt it
> >> like this?
> >
> > Because the right thing (i.e. signaling an error) was not backward
> > compatible with broken code that assumed that chars can be presented
> > with 8bit (i.e. code written in the glory days of latin-N, koi-8, ...).
> >
> > We could/should probably try to do the right thing now, since such
> > broken code is probably much less common.
>
> (Now eight years later.)
>
> So the suggestion is to make inserting multibyte strings into a unibyte
> buffer signal an error (instead of inserting the lower byte of
> characters).
>
> Has anybody experimented with doing this and seeing whether this signals
> a lot of errors in daily usage?
Why not make both methods do the same: insert the bytes of the
multibyte text into the unibyte buffer?
Making the buffer unibyte after insertion is a PITA, because it could
be very slow if the text in the buffer is long. That's why people may
wish to do it the other way around: making an empty buffer unibyte is
a snap.
This bug report was last modified 4 years and 12 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.