]> git.phdru.name Git - bookmarks_db.git/blobdiff - Robots/parse_html.py
Fixed parsing in case of unknown entity.
[bookmarks_db.git] / Robots / parse_html.py
index 80c7aa89d28efed06db8a598088303f44d2b338b..fd8dc927c0d78d7adcd8394457774450ff9dd403 100755 (executable)
@@ -34,8 +34,12 @@ def recode_entities(title, charset):
    for part in entity_re.split(title):
       if part not in ("&", "<", ">", """) and \
             entity_re.match(part):
-         part = unichr(name2codepoint.get(part[1:-1], part)).encode(charset)
-      output.append(part)
+         _part = name2codepoint.get(part[1:-1], None)
+         if _part is None:
+             _part = part
+         else:
+             _part = unichr(_part).encode(charset)
+      output.append(_part)
    title = ''.join(output)
 
    output = []