UnicodeEncodeError:'ascii'编解码器无法在位置20编码字符u'\\ xa0':序数不在范围内(128)
问题: I'm having problems dealing with unicode characters from text fetched from different web pages (on different sites). 我在处理从不同网页(在不同站点上)获取的文本中的unicode字符时遇到问题。 I am using BeautifulSoup. 我正在使用BeautifulSoup。 The problem is that the error is not always reproducible; 问题是错误并非总是可重现的。 it sometimes works with some pages, and sometimes, it barfs by throwing a UnicodeEncodeError . 它有时可以在某些页面上使用,有时它会通过抛出 UnicodeEncodeError 来阻止。 I have tried just about everything I can think of, and yet I have not found anything that works consistently without throwing some kind of Unicode-related error.