From c44f842c2c1018fb13bc0e3d109ada62892b01b9 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 5 Nov 2008 12:53:00 -0800 Subject: [PATCH] Fix #1214 (Feeds2lrf crash when downloading http://rss.gazeta.pl/pub/rss/gazetawyborcza.xml) --- src/calibre/utils/genshi/template/eval.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/calibre/utils/genshi/template/eval.py b/src/calibre/utils/genshi/template/eval.py index d9bbc846d3..0e9fae6d64 100644 --- a/src/calibre/utils/genshi/template/eval.py +++ b/src/calibre/utils/genshi/template/eval.py @@ -177,7 +177,10 @@ class Expression(Code): """ __traceback_hide__ = 'before_and_this' _globals = self._globals(data) - return eval(self.code, _globals, {'__data__': data}) + code = self.code + if not isinstance(code, unicode): + code = code.decode('utf-8', 'replace') + return eval(code, _globals, {'__data__': data}) class Suite(Code):