]> git.phdru.name Git - bookmarks_db.git/blobdiff - Robots/bkmk_robot_base.py
Fix(Robots/bkmk_robot_base): Ignore unknown charset
[bookmarks_db.git] / Robots / bkmk_robot_base.py
index 724391853f57f4d7912f579e261d403de35ccb47..1e511d0b48a625e752f337431892ff7872c050bf 100644 (file)
@@ -135,8 +135,13 @@ class robot_base(Robot):
                             break
                     content_stripped = content.strip()
                     if content_stripped and charset:
-                        content_stripped = content_stripped.decode(
-                            charset, 'replace')
+                        try:
+                            content_stripped = content_stripped.decode(
+                                charset, 'replace')
+                        except LookupError:
+                            charset = None
+                            self.log("   unknown charset "
+                                     "in Content-Type header")
                     if content_stripped and is_html:
                         parser = parse_html(
                             content_stripped, charset, self.log)