I want to assign address of a file to a variable named 's':
>>> s= 'D:/4-Tutorials/Network/CCNA-farsi-shariaty/روش های آدرس دهی IP و Subnetting.mp4'
Unsupported characters in input
>>> s= u'D:/4-Tutorials/Network/CCNA-farsi-shariaty/روش های آدرس دهی IP و Subnetting.mp4'
Unsupported characters in input
>>> s='D:/4-Tutorials/Network/CCNA-farsi-shariaty/روش های آدرس دهی IP و Subnetting.mp4'.decode('utf8')
Unsupported characters in input
>>> s='D:/4-Tutorials/Network/CCNA-farsi-shariaty/روش های آدرس دهی IP و Subnetting.mp4'.encode('utf8')
Unsupported characters in input
>>> s='D:/4-Tutorials/Network/CCNA-farsi-shariaty/روش های آدرس دهی IP و Subnetting.mp4'.decode('utf-8')
Unsupported characters in input
As you see I returns me Unsupported characters in input error. and this error is because of the Arabic/Persian letters in the file name.
The weird thing is that I can write Arabic/Persian in IDLE and I can have a string variable containing Arabic/Persian letters:
>>> s = "سلام"
>>> s = "روش هاي آدرس دهي"
Finally I found that the origin of problem is one letter that has two different form between Persian and Arabic. It is "ی" and "ي". Both indicate the same letter, first is for Persian and the second is for Arabic. (Arabic form has two dot (.) in under the letter).
As you see, I can't use one form:
>>> s = "ي"
>>> s = "ی"
Unsupported characters in input
>>>
How can I handle this issue? Is there anyway to add a font to IDLE for example?
I'm using Ubuntu + IDLE with no problem.
>>> a = "جادی"
>>> print (a)
جادی
>>> a
'\xd8\xac\xd8\xa7\xd8\xaf\xdb\x8c'
Check the Options ~ Configure IDLE ~ General menu. There you can set the UTF-8 and from the first tab you can choose your font.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With