[Python-3000] Support for PEP 3131

"Martin v. Löwis" martin at v.loewis.de
Sun Jun 3 01:08:01 CEST 2007


> Sincere question: if these characters aren't needed, why are they
> provided? From what I can tell by googling, they're needed when, e.g.,
> Arabic is embedded in an otherwise left-to-right script. Do I have
> that right?

I think not. In principle, each character has a directionality
(available through unicodedata.bidirectional), and a rendering
algorithm should be able detect runs of characters that differ
in directionality from the surrounding text, rendering it
properly. As a special case, certain characters are declared
"neutral", extending the run across, say, spaces.

So embedding Arabic in an LTR text *alone* makes no requirement for
these control characters. I'm unsure whether there are cases where
the standard BIDI algorithm would produce incorrect results;
it's certainly the case that not all tools implement it correctly,
so the control characters can help those tools (assuming the
tool implements the control character at least).

Regards,
Martin


More information about the Python-3000 mailing list