GNU bug report logs -
#52459
28.0.90; prin1-to-string does not escape bidi control characters despite print-escape-control-characters=t
Previous Next
Full log
Message #20 received at 52459 <at> debbugs.gnu.org (full text, mbox):
> Sorry, I don't understand. The examples you provided are of text
> being displayed. Which is expected, since these controls have no
> other effect _except_ when the text is displayed. So why isn't the
> existing function bidi-string-mark-left-to-right (which was introduced
> precisely for the situations like you describe, and is actually used
> in Emacs for those purposes) the solution for the class of problems
> that you described?
`bidi-string-mark-left-to-right` is an insufficient solution since it
manipulates the string on the level of display properties. It appends an
invisible character. If I take the string returned by
`bidi-string-mark-left-to-right` I cannot manipulate it freely
afterwards. In particular if I truncate the string, the invisible
character will be lost again.
I need a function which sanitizes a string completely, such that after
sanitization I can use and manipulate it without having to worry about
display properties or other pecularities.
> And can we agree that displaying these characters as escapes would not
> solve the problems you had in mind, so it is off the table for the
> rest of this discussion?
No, I disagree. This should not be off the table. I don't understand why
you want to close this issue so quickly. The probem I described is an
actual problem, which I've observed in multiple packages. Ideally Emacs
would offer a solution on the API level such that package authors and
users can sanitize strings in a robust way. Such an API does not exist
currently.
Escaping all control characters is my preferred solution. What about
adding two variables: `print-escape-unicode-control-characters` and
`print-escape-ascii-control-characters`, such that it is explicit what
is going on? The variable `print-escape-control-characters` could be
deprecated or aliased to `print-escape-ascii-control-characters`.
This bug report was last modified 3 years and 183 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.