href += ':' + quote(password)
href += '@'
if host:
- href += host.decode(parser_charset or 'utf-8').encode('idna')
+ href += host.encode('idna').decode('ascii')
if port:
href += ':%d' % port
if path:
def unquote_title(title):
if BKMK_FORMAT == "MOZILLA":
- from HTMLParser import HTMLParser
- title = HTMLParser().unescape(
- title.replace("&", '&').decode('utf-8'))
- title = title.encode('utf-8').replace("'", "'")
+ try:
+ from HTMLParser import HTMLParser
+ except ImportError:
+ from html import unescape
+ else:
+ unescape = HTMLParser().unescape
+ title = unescape(
+ title.replace("&", '&'))
+ title = title.replace("'", "'")
return title