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.
Translation:
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:
unicodeData.encode('ascii', 'ignore')
' ignore ' will tell you to skip these characters. From the Python documentation:
>>> u = unichr(40960) + u'abcd' + unichr(1972)
>>> u.encode('utf-8')
'\xea\x80\x80abcd\xde\xb4'
>>> u.encode('ascii')
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')
'abcd'
>>> u.encode('ascii', 'replace')
'?abcd?'
>>> u.encode('ascii', 'xmlcharrefreplace')
'ꀀabcd޴'
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).
NOTE:
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 .