]> git.phdru.name Git - bookmarks_db.git/commitdiff
Encode icon's URL from unicode.
authorOleg Broytman <phd@phdru.name>
Sun, 2 Jan 2011 00:40:46 +0000 (00:40 +0000)
committerOleg Broytman <phd@phdru.name>
Sun, 2 Jan 2011 00:40:46 +0000 (00:40 +0000)
git-svn-id: file:///home/phd/archive/SVN/bookmarks_db/trunk@301 fdd5c36f-1aea-0310-aeeb-c58d7e2b6c23

Robots/parse_html.py

index 228a3ceaddff6c0fe1acc8af64a374f348c5bb27..a83585df318afb1602a916a1a17768485a099138 100755 (executable)
@@ -143,6 +143,14 @@ def parse_html(filename, charset=None, log=None):
       final_title = ' '.join([s for s in parts if s])
       if log and (final_title <> converted_title): log("   final title    : %s" % final_title)
       parser.title = final_title
+
+   icon = parser.icon
+   if isinstance(icon, unicode):
+       try:
+           parser.icon = icon.encode('ascii')
+       except UnicodeEncodeError:
+           if parser.charset:
+               parser.icon = icon.encode(parser.charset)
    return parser