Why? Because BeautifulSoup's string class has a broken encode
implementation... and it appears that the unicode class is smart enough
to not reuse the object when it's a subclass anyway.
# This is a subclass of unicode (e.g. BeautifulSoup's
# NavigableString, which is unpickleable in some versions of
# the library), so force it to be a real unicode object.
- return value.encode("UTF-8").decode("UTF-8")
+ return unicode(value)
elif isinstance(value, dict):
d = {}
for (k, v) in value.items():