all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#27270: display-raw-bytes-as-hex generates ambiguous output for Emacs strings
@ 2017-06-07  3:57 Paul Eggert
  2017-06-07  5:17 ` Eli Zaretskii
  0 siblings, 1 reply; 39+ messages in thread
From: Paul Eggert @ 2017-06-07  3:57 UTC (permalink / raw)
  To: 27270; +Cc: Vasilij Schneidermann

With the default octal display format one can copy text out of a terminal window 
and into an Emacs string, reliably. With the new hex display this doesn't work 
any more, unfortunately. For example, if I run this shell script:

printf 'x\2205y\n' >foo.txt
LC_ALL=C emacs -nw --color=no --eval '(progn (setq display-raw-bytes-as-hex t) 
(find-file-literally "foo.txt"))'

then on the terminal display I see:

x\x905y

If I cut and paste this (using my windowing system) into an Emacs string, like this:

"x\x905y"

and then evaluate the string, the result is the string "xअy", that is, a 
3-character string with the characters "x", "अ", and "y", where the middle 
character is U+090F DEVANAGARI LETTER A. This is an incorrect representation, as 
the buffer actually contains the four characters "x", "\x90", "5", and "y". The 
problem is that the string has glued together the representation of the 
character "\x90" to the representation of the character "5", resulting in the 
representation of the character "\x905" which is not accurate.

Please change the behavior of display-raw-bytes-as-hex so that it is not 
ambiguous in this way.

A simple solution would be to display this instead:

x\x90\x35y

though that is awkward because it means the ASCII 0-9, a-f, A-F would be 
displayed as hexadecimal escapes when they follow another hexadecimal escape. 
Perhaps we can think of a better approach. One possibility would be to define 
and use a new string escape \Xxx that contains at most two hex digits.

By the way, I expected display-raw-bytes-as-hex to affect how Emacs displays 
Emacs strings, too. Shouldn't it?





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

end of thread, other threads:[~2022-04-28 17:58 UTC | newest]

Thread overview: 39+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-07  3:57 bug#27270: display-raw-bytes-as-hex generates ambiguous output for Emacs strings Paul Eggert
2017-06-07  5:17 ` Eli Zaretskii
2017-06-08  0:49   ` Paul Eggert
2017-06-08  1:07     ` npostavs
2017-06-08 15:20       ` Eli Zaretskii
2017-06-08 15:56       ` Paul Eggert
2017-06-08 16:11         ` Eli Zaretskii
2017-06-08 16:24           ` Paul Eggert
2017-06-08 18:59             ` Eli Zaretskii
2017-06-08 19:43               ` Paul Eggert
2017-06-08 19:56                 ` Eli Zaretskii
2017-06-08 20:35                   ` Paul Eggert
2017-06-09  6:00                     ` Eli Zaretskii
2017-06-09 23:44                       ` Paul Eggert
2017-06-10  7:24                         ` Eli Zaretskii
2017-06-11  0:04                           ` Paul Eggert
2017-06-11 14:48                             ` Eli Zaretskii
2017-06-11 17:26                               ` Paul Eggert
2017-09-02 13:25                                 ` Eli Zaretskii
2022-04-23 14:00                         ` Lars Ingebrigtsen
2022-04-24  7:10                           ` Paul Eggert
2022-04-24  9:56                             ` Vasilij Schneidermann
2022-04-24 10:26                               ` Andreas Schwab
2022-04-24 10:51                                 ` Vasilij Schneidermann
2022-04-24 11:01                                   ` Andreas Schwab
2022-04-24 11:29                                     ` Lars Ingebrigtsen
2022-04-24 22:46                               ` Paul Eggert
2022-04-24 11:24                             ` Lars Ingebrigtsen
2022-04-24 22:35                               ` Paul Eggert
2022-04-25  7:40                                 ` Lars Ingebrigtsen
2022-04-25 16:49                                   ` Paul Eggert
2022-04-26 10:06                                     ` Lars Ingebrigtsen
2022-04-26 16:48                                       ` Paul Eggert
2022-04-27 12:13                                         ` Lars Ingebrigtsen
2022-04-27 17:21                                           ` Paul Eggert
2022-04-27 17:22                                             ` Lars Ingebrigtsen
2022-04-28 17:58                                               ` Paul Eggert
2017-06-10 22:52         ` npostavs
2017-06-11  0:10           ` Paul Eggert

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.