emacs-devel
[Top][All Lists]
Advanced

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

bidi-string-strip-control-characters


From: Eli Zaretskii
Subject: bidi-string-strip-control-characters
Date: Thu, 20 Jan 2022 11:23:08 +0200

Lars, I'm not sure I understand the purpose of this function.  Can you
explain?

The way it is currently used is also strange, to say the least: you
apply it to a string made of a single character, so either it does
nothing to the string, or it will return an empty string.  So the
following code will present the user with a riddle:

  (textsec-email-address-header-suspicious-p
   "Lars Ingebrigtsen <larsi@\N{RIGHT-TO-LEFT OVERRIDE}gnus.org>")
  "Disallowed character: `' (#x202e, RIGHT-TO-LEFT OVERRIDE)"

The empty string between quotes is the riddle.

I think I understand the original problem: displaying a literal U+202E
there will mess up the text on display, but if that is the reason, the
right way is not to remove the character, it is to append to it the
necessary bidi controls to prevent the messup (and make the appended
controls be invisible).

Here's an example:

  (insert (format "Disallowed character: `%s' (#x202e, RIGHT-TO-LEFT OVERRIDE)"
                (concat (string ?\x202e)
                        (propertize (string ?\x202c ?\x200e) 'invisible t))))

This displays the RLO character, but doesn't mess up the description
after it.

We do something like that in descr-text.el, so I guess we need to
factor out that code and use it here.



reply via email to

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