projects
/
rss2maildir.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(from parent 1:
0cecf7d
)
More utf-8 handling for images
author
Brett Parker
<iDunno@sommitrealweird.co.uk>
Tue, 30 Apr 2013 20:17:40 +0000
(21:17 +0100)
committer
Brett Parker
<iDunno@sommitrealweird.co.uk>
Tue, 30 Apr 2013 20:17:40 +0000
(21:17 +0100)
- iff we get a string object rather than a unicode one, decode it from utf-8
rss2maildir.py
patch
|
blob
|
history
diff --git
a/rss2maildir.py
b/rss2maildir.py
index dc0427a6d2e8ac9ee5a206a89ce5f0634364a3f8..a9abe4d1496cb676ffe4e3efe41d623431835dbe 100755
(executable)
--- a/
rss2maildir.py
+++ b/
rss2maildir.py
@@
-307,9
+307,15
@@
class HTML2Text(HTMLParser):
url = u''
for attr in attrs:
if attr[0] == 'alt':
- alt = attr[1]
+ if isinstance(attr[1], str):
+ alt = u'%s' %(attr[1].decode("utf-8"))
+ else:
+ alt = attr[1]
elif attr[0] == 'src':
- url = attr[1]
+ if isinstance(attr[1], str):
+ url = u'%s' %(attr[1].decode("utf-8"))
+ else:
+ url = attr[1]
if url:
if alt:
if self.images.has_key(alt):