Reading from a database I get the following value
b'd\xe2\x80\x99int'
How can I print it to get the string d’int
(note that this is different from d'int
)?
I tried with print(b'd\xe2\x80\x99int'.decode('utf-8'))
but I get the error:
UnicodeEncodeError: 'ascii' codec can't encode character '\u2019' in position 1: ordinal not in range(128)
EDIT: thanks to the comment I understood that the problem is not in my Python code but in emacs, I am having exactly the same problem as described here Unicode conversion issue using Python in Emacs
I will close the question