Open GoogleCodeExporter opened 9 years ago
plz help to delete this issue or remove my blog address...
This problem is caused by using new Python/BeautifulSoup. Using Python 2.5.4 &
Beautiful Soup 3.0.6 works fine.
Original comment by wangxiao...@gmail.com
on 11 Jan 2010 at 4:23
Change the __new__ method for NavigableString in Beautiful Soup can fix this:
def __new__(cls, value):
"""Create a new NavigableString.
When unpickling a NavigableString, this method is called with
the string in DEFAULT_OUTPUT_ENCODING. That encoding needs to be
passed in to the superclass's __new__ or the superclass won't know
how to handle non-ASCII characters.
"""
if isinstance(value, unicode):
return unicode.__new__(cls, value)
elif isinstance(value, Tag):
print value
return unicode.__new__(cls, value.__str__(), DEFAULT_OUTPUT_ENCODING)
else:
return unicode.__new__(cls, value, DEFAULT_OUTPUT_ENCODING)
Original comment by robert.z...@gmail.com
on 28 Sep 2010 at 2:57
oops, that "print value" is for debugging, you should remove it.
Original comment by robert.z...@gmail.com
on 28 Sep 2010 at 2:58
Original issue reported on code.google.com by
wangxiao...@gmail.com
on 11 Jan 2010 at 2:53