From: "Jürgen Hartmann" <juergen_hartmann_@hotmail.com>
To: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Subject: Differences between identical strings in Emacs lisp
Date: Mon, 6 Apr 2015 15:21:46 +0200 [thread overview]
Message-ID: <DUB124-W4882427726E23EA5181182A8FE0@phx.gbl> (raw)
What is the difference between the string represented by the constant "\xBA"
and the result of (concat '(#xBA))?
Background:
When I start Emacs 24.4 in Linux with the -Q option and the POSIX locale to
have clean conditions, i.e.
LC_ALL=C emacs -Q
the evaluation of
"\xBA"
in *scratch* (lisp interaction mode) yields a result
printed as "\272".
In contrast to that, the result of
(concat '(#xBA))
is printed as "º", i.e. the "masculine ordinal indicator" glyph in double
quotes. The glyph's character is described by the command describe-char as
follows:
-----------------------------------------------------------------------------
position: 235 of 341 (69%), column: 1
character: º (displayed as º) (codepoint 186, #o272, #xba)
preferred charset: unicode (Unicode (ISO10646))
code point in charset: 0xBA
script: latin
syntax: _ which means: symbol
category: .:Base, L:Left-to-right (strong), h:Korean, j:Japanese, l:Latin
to input: type "C-x 8 RET HEX-CODEPOINT" or "C-x 8 RET NAME"
buffer code: #xC2 #xBA
file code: #xC2 #xBA (encoded by coding system nil)
display: by this font (glyph code)
xft:-unknown-DejaVu Sans Mono-normal-normal-normal-*-15-*-*-*-m-0-iso10646-1 (#x7C)
Character code properties: customize what to show
name: MASCULINE ORDINAL INDICATOR
general-category: Lo (Letter, Other)
decomposition: (super 111) (super 'o')
There are text properties here:
face font-lock-string-face
fontified t
[back]
-----------------------------------------------------------------------------
Obviously the result of (concat '(#xBA)) gets interpreted (decoded) on the
basis of the unicode charset, while "\xBA" is treated as a raw byte.
Comparing these strings directly also shows hat they are different:
(string= "\xBA" (concat '(#xBA)))
evaluates to nil.
On the other hand, the expressions
(append "\xBA" ())
and
(append (concat '(#xBA)) ())
both evaluate to (186), indicating that the strings contain the same
character(s). So they are identical.
How to resolve this contradiction?
Since I could not find a clue in the manuals or via google, any explanation,
idea, hint, link is greatly appreciated.
Juergen
next reply other threads:[~2015-04-06 13:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-06 13:21 Jürgen Hartmann [this message]
2015-04-07 21:10 ` Differences between identical strings in Emacs lisp Stefan Monnier
2015-04-08 11:02 ` Jürgen Hartmann
2015-04-08 13:44 ` Jürgen Hartmann
[not found] <mailman.76.1428326518.904.help-gnu-emacs@gnu.org>
2015-04-07 0:10 ` Pascal J. Bourguignon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DUB124-W4882427726E23EA5181182A8FE0@phx.gbl \
--to=juergen_hartmann_@hotmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.