From: Oleg Broytman Date: Sun, 2 Jan 2011 00:40:46 +0000 (+0000) Subject: Encode icon's URL from unicode. X-Git-Tag: v4.5.3~75 X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=4fd6d1f55e5e5dbcc0bdc1b933d6e14076316437;p=bookmarks_db.git Encode icon's URL from unicode. git-svn-id: file:///home/phd/archive/SVN/bookmarks_db/trunk@301 fdd5c36f-1aea-0310-aeeb-c58d7e2b6c23 --- diff --git a/Robots/parse_html.py b/Robots/parse_html.py index 228a3ce..a83585d 100755 --- a/Robots/parse_html.py +++ b/Robots/parse_html.py @@ -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