I am using Python 2.7 and i try to print Arabic strings like these
print "ذهب الطالب الى المدرسة"
it's give the following output:
ط°ظ‡ط¨ ط§ظ„ط·ط§ظ„ط¨ ط§ظ„ظ‰ ط§ظ„ظ…ط¯ط±ط³ط©
The purpose is to print the text correctly, and not how to print each line. So, how can I print the string or content of text file correctly in its original form? like:
ذهب الطالب الى المدرسة
Try this:
Output:
Demo: https://repl.it/EuHM/0
The default Python2.7 string works with utf-8 character set. And arabic is not included inside utf-8. So if you prefix it with
uthen it will treat that string as unicode string.