Below is an adapted translation of a response made to StackOverflow (the original) for a similar problem to yours. You can see the original question here with your answers.
You're probably trying to print text that contains foreign Unicode characters - compared to the basic ASCII 128 - which may be our language. Try encode the Unicode string as ASCII 256 first:
' ignore ' will tell you to skip these characters. From the Python documentation:
>>> u = unichr(40960) + u'abcd' + unichr(1972)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
UnicodeEncodeError: 'ascii' codec can't encode character '\ua000' in position 0: ordinal not in range(128)
>>> u.encode('ascii', 'ignore')
>>> u.encode('ascii', 'replace')
>>> u.encode('ascii', 'xmlcharrefreplace')
It may be useful to read the article " Absolute Absolute Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets. Excuses!) "*, which I think is a good tutorial for what is happening. After reading, you will stop feeling that you are just finding what the commands do (at least, that is what happened to me).
There is a translation of the mentioned article, as indicated by @jsbueno. This article is authored by Joel Spolsky and translated by Paulo André de Andrade. See here .