I wrote a very simple program in Python that shows names of the folders in a specific direction on my computer. The program performs well, but the problem is that when I have a file or folder named with Persian characters and running the program in Windows cmd or PowerShell, they show the characters in this form: ?
I investigated this problem and there were suggestions like typing chcp 65001
command, but when I do this and retry the program, I get this error:
Traceback (most recent call last):
File "p.py", line 39, in <module>
g=(path_dic(a))
File "p.py", line 23, in path_dic
print('%d : %s'%(i,dic[i]))
PermissionError: [WinError 31] A device attached to the system is not functioning
Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>
PermissionError: [WinError 31] A device attached to the system is not functioning
By the way: When I run the program in my IDE (pycharm), it displays the characters without problem, but I'm curious to see if there is a way to display Persian characters in Windows cmd or PowerShell?
I have also done changing the font to consolas or lucida and still not working