From 4fd6d1f55e5e5dbcc0bdc1b933d6e14076316437 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Sun, 2 Jan 2011 00:40:46 +0000 Subject: [PATCH] Encode icon's URL from unicode. git-svn-id: file:///home/phd/archive/SVN/bookmarks_db/trunk@301 fdd5c36f-1aea-0310-aeeb-c58d7e2b6c23 --- Robots/parse_html.py | 8 ++++++++ 1 file changed, 8 insertions(+) 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 -- 2.39.5