all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Why does using aset sometimes output raw bytes?
@ 2018-12-09 15:16 Stephen Berman
  2018-12-09 15:20 ` Eli Zaretskii
  2018-12-09 17:10 ` Stefan Monnier
  0 siblings, 2 replies; 17+ messages in thread
From: Stephen Berman @ 2018-12-09 15:16 UTC (permalink / raw)
  To: help-gnu-emacs

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




^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2018-12-10 13:56 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-09 15:16 Why does using aset sometimes output raw bytes? Stephen Berman
2018-12-09 15:20 ` Eli Zaretskii
2018-12-09 15:46   ` Stephen Berman
2018-12-09 15:56     ` Stephen Berman
2018-12-09 17:12     ` Eli Zaretskii
2018-12-09 17:32       ` Stephen Berman
2018-12-09 17:47         ` Eli Zaretskii
2018-12-09 18:50           ` Stephen Berman
2018-12-09 18:55             ` Eli Zaretskii
2018-12-09 17:10 ` Stefan Monnier
2018-12-09 17:20   ` Stephen Berman
2018-12-09 19:20     ` Stefan Monnier
2018-12-09 20:23       ` Eli Zaretskii
2018-12-09 21:20         ` Stefan Monnier
2018-12-10  5:59           ` Eli Zaretskii
2018-12-10 13:56             ` Stefan Monnier
2018-12-09 20:43       ` Stephen Berman

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.