def handle_data(self, data):
if data:
if self.charset and default_encoding:
- data = unicode(data, self.charset, "replace").\
+ data = data.decode(self.charset, "replace").\
encode(default_encoding, "xmlcharrefreplace")
self.accumulator += data
converted_title = title = parser.title
if title and (not parser.charset):
try:
- unicode(title, "ascii")
+ title.decode("ascii")
except UnicodeDecodeError:
parser.charset = DEFAULT_CHARSET
if log: log(" title : %s" % title)
if parser.charset != universal_charset:
try:
- converted_title = unicode(title, parser.charset).\
+ converted_title = title.decode(parser.charset).\
encode(universal_charset)
except UnicodeError:
if log:
"converting from %s"
% (parser.charset, DEFAULT_CHARSET))
converted_title = \
- unicode(title, DEFAULT_CHARSET, "replace").\
+ title.decode(DEFAULT_CHARSET, "replace").\
encode(universal_charset, "replace")
parser.charset = DEFAULT_CHARSET
if log and (converted_title != title):