خرید بک لینک

Vote count: 0

I'm trying to open a file, read the file and print out. Well this should be easy and look like this:

file = open("Testfile.txt", "r")
string = file.read()
print(string)
file.close()

So now, I want to open a file including Unicode Charcters, going above the 255 characters which can be encoded with 'charmap', as I understood right.

So what happens now is, that the Error "UnicodeEncodeError" raises and my program crashes.

My question: What do I have to do to print and read the UniCode characters correctly without raising an error?

Thx for help

Note: I do not want to get things like U000800 or x80, because I can't do anything with them. I need the characters, as you can pick them out of the Unicode Table.

asked 5 mins ago

برچسب: نویسنده: استخدام کار تاريخ: چهارشنبه 25 فروردين 1395 ساعت: 4:16

صفحه بندی