mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 19:19:32 +01:00
Fix fetch of RSS feeds containing unicode.
This commit is contained in:
parent
63f911b8a4
commit
8d95a424b0
@ -450,7 +450,11 @@ def format(s, *args, **kwargs):
|
|||||||
def sub(match):
|
def sub(match):
|
||||||
char = match.group(1)
|
char = match.group(1)
|
||||||
if char == 's':
|
if char == 's':
|
||||||
return str(args.pop())
|
token = args.pop()
|
||||||
|
if isinstance(token, unicode) or isinstance(token, str):
|
||||||
|
return token
|
||||||
|
else:
|
||||||
|
return unicode(token)
|
||||||
elif char == 'i':
|
elif char == 'i':
|
||||||
# XXX Improve me!
|
# XXX Improve me!
|
||||||
return str(args.pop())
|
return str(args.pop())
|
||||||
|
@ -180,7 +180,7 @@ class HtmlToText(HTMLParser, object):
|
|||||||
self.data.append(data)
|
self.data.append(data)
|
||||||
|
|
||||||
def handle_entityref(self, data):
|
def handle_entityref(self, data):
|
||||||
self.data.append(chr(htmlentitydefs.name2codepoint[data]))
|
self.data.append(unichr(htmlentitydefs.name2codepoint[data]))
|
||||||
|
|
||||||
def getText(self):
|
def getText(self):
|
||||||
text = ''.join(self.data).strip()
|
text = ''.join(self.data).strip()
|
||||||
|
Loading…
Reference in New Issue
Block a user