]> git.phdru.name Git - bookmarks_db.git/blobdiff - parse_html/bkmk_parse_html.py
Fix(Py3): Replace `unicode()` with `.decode()`
[bookmarks_db.git] / parse_html / bkmk_parse_html.py
index 6afb7f9df735f6a487b6b7537fc23f2c3daa71c2..997bf6489c9a2e49a44c74d1062a61aa85191cf5 100644 (file)
@@ -167,7 +167,7 @@ def parse_html(html_text, charset=None, log=None):
     converted_title = title = parser.title
     if title and (not parser.charset):
         try:
-            unicode(title, "ascii")
+            title.decode("ascii")
         except UnicodeDecodeError:
             parser.charset = DEFAULT_CHARSET
 
@@ -186,7 +186,7 @@ def parse_html(html_text, charset=None, log=None):
             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:
@@ -194,7 +194,7 @@ def parse_html(html_text, charset=None, log=None):
                             "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):