help-gnu-emacs
[Top][All Lists]
Advanced

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

Why does using aset sometimes output raw bytes?


From: Stephen Berman
Subject: Why does using aset sometimes output raw bytes?
Date: Sun, 09 Dec 2018 16:16:15 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

When I use aset to change characters in a string to certain non-ascii
characters and insert the result into a buffer, the non-ascii characters
are displayed as raw bytes.  This only happens with certain non-ascii
characters, and also only if the string being altered is bound to a
variable and aset takes that variable as argument; if aset operates
directly on the string, those same non-ascii characters are inserted as
the expected characters.  To reproduce, start emacs with -Q and evaluate
the following sexp:

(let ((s0 "aous")
      (s1 "äöüß")
      (s2 "sdfg")
      (s3 "ſðđŋ"))
  (dolist (s `((,s0 . ,s1) (,s2 . ,s3)))
    (dotimes (i 4)
      (aset (car s) i (aref (cdr s) i))))
  (insert s0 s2 "\n")
  (dotimes (i 4)
    (insert (aset "aous" i (aref "äöüß" i))))
  (dotimes (i 4)
    (insert (aset "sdfg" i (aref "ſðđŋ" i)))))

Here's what gets inserted into the buffer (I've represented the raw
bytes by ascii strings to make sure they're readable here):

\344\366\374\337ſðđŋ
äöüßſðđŋ

Is this expected, and if so, what's the explanation, i.e., why does this
happen with some non-ascii characters (e.g. äöüß) but not with others
(e.g ſðđŋ) and why does it happen when aset gets passed a variable
for the string but not when it gets passed the string itself?

Steve Berman




reply via email to

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