7 Answers
+ 5
Maybe your file is encoded with a charset different from utf-8.
You can probably check it by opening it with a text editor such as notepad++
You might be able to open it correctly from python, if you specify the encoding= keyword argument for the open() function. Something like:
with open('file.txt', 'r', encoding='latin_1') as file:
print(file.read())
+ 3
Have you figured out the actual file encoding? It may be different from latin_1, is why I told you to check first.
You can find a list of all encodings that python understand, here :
https://docs.python.org/3/library/codecs.html#module-codecs
+ 1
Tibor Santa
Thank you it works
But now the problem is with Ăą
It prints À
+ 1
Tibor Santa
Thank you
+ 1
I have had the same issues when I was using QPython3.
For some reason, special letters were corrupted, although that *never* happened with regular desktop Python and the very same script. đ
I basically closed my eyes and hoped, the issue would disappear. Which it didn't.
+ 1
Ok then
Thank you HonFu
+ 1
Hi Iren Yeger
Do you have any update on this?
I am experiencing the same error.
What code made you fix this, if you did fix this?
Kindest regards