Python :- UnicodeEncodeError: 'charmap' codec can't encode character u'\u2014' in position

No replies
abharti
Offline
Joined: 02/04/2015

Question received by our support team:
I am running my script in python.
Running the code shows this error when it fails to switch from the default ASCII to other encoding such as UTF-8.

The answer
You can try following -

- import sys
- reload(sys)
- sys.setdefaultencoding("utf-8")

You can find more detail about this issue on below link -
http://stackoverflow.com/questions/3828723/why-we-need-sys-setdefaultenc...

Note :- - Ensure you are using latest version of Python.