A problem had been plaguing me all day where Python 3.4.1 keeps returning
UnicodeEncodeError: 'charmap' codec can't encode character '\u25be' in position 1075: character maps to undefined
Unicode shows that U+25BE is ▾ BLACK DOWN-POINTING SMALL TRIANGLE.
I have been trying to read a file that contains this little guy and no matter what I do it doesn't seem to work. Here is the relevant code:
whole = ""
f = open(src, 'r', encoding='utf-8')
for l in f:
whole += l
print(whole)
The print will throw the error above. I have tried encoding it to ASCII with:
l.encode('ascii', 'ignore')
and still nothing. Am I failing to decode the file wrong? If it helps, this is also a webpage, and using the urllib.request
module yields the exact same result.
I'm using Windows 7 if that makes a difference.