UnicodeEncodeError: ‘charmap’ codec can’t encode character ‘\u2010’: character maps to [duplicate]

Already figured it out. As it is noted in this answer, the encoding error doesnt come from python, but from the encoding that the console is using. So the way to fix it is to run the command (in windows):

chcp 65001

that sets the encoding to UTF-8 and then run the program again. Or if working on pycharm as I was, go to Settings>Editor>File Encodings and set the IDE and Project encodings accondingly.

Leave a Comment