print arabic characters
Martin v. Loewis
martin at v.loewis.de
Mon Dec 22 07:07:10 EST 2003
Ahmad wrote:
> I am a python newbie, I want to print on the console UTF-8 arabic
> characters. They print OK with
> print text.encode("UTF-8")
Are you talking about console mode (i.e. the cmd.exe window)? Or are
you perhaps talking about IDLE?
In Python 2.3, they should also print ok when you print a Unicode object
proper; sys.stdout.encoding should indicate what encoding the terminal
uses.
> BUT, the characters are printed LTR, not RTL (right to left). How can
> I change the printing direction??
Assuming it is IDLE: This is a bug in Tk, then - I don't know whether
Tk supports RTL.
Assuming it is the terminal: Does the terminal support RTL in the first
place? Python does nothing else but write the characters in logical
order to the terminal stream; it would be the terminal's job to put
them in the right display order. Perhaps printing RIGHT-TO-LEFT MARK
(U+U200F) helps?
Regards,
Martin
More information about the Python-list
mailing list