0

Hello.
There is a text in my Python script that is in Persian language and the letters are from left to right, but in Persian language letters should be written from right to left.
What should i do now to fix it and print it in UTF-8 format?

3
Contributors
2
Replies
33
Views
1 Year
Discussion Span
Last Post by megaflo
0

The most Pythonic [::-1]
There is also reversed used with join().

Python34 handels Unicode good if you get Persian language correct decoded into Python34.
In Python34 are all strings a sequences of Unicode characters.
Just so you know,there is a big difference between Unicode handling Python 2 and 3.

>>> s = 'ԈԇՄՋֆ'
>>> s
'ԈԇՄՋֆ'
>>> print(s)
ԈԇՄՋֆ
>>> s[::-1]
'ֆՋՄԇԈ'
>>> print(s[::-1])
ֆՋՄԇԈ
>>> print(''.join(reversed(s)))
ֆՋՄԇԈ

Hmm look like Persian character has a problem here.

ԈԇՄՋֆ

Edited by snippsat

0

I'm sorry that I can't answer directly so I suggest you try the main mailing list at or. The people there have forgotten far more than I've ever known about unicode, so I'm certain that you'll get very sound answers :)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.