changeset 26:197980874dd4

more warning feedback
author Atul Varma <varmaa@toolness.com>
date Sun, 03 Jan 2010 06:36:19 -0800
parents 35a52998884f
children 83091b7b3e59
files publish_edition.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/publish_edition.py	Sun Jan 03 06:33:50 2010 -0800
+++ b/publish_edition.py	Sun Jan 03 06:36:19 2010 -0800
@@ -77,7 +77,11 @@
         for key in obj:
             obj[key] = normalize(obj[key])
     elif isinstance(obj, str):
-        obj = obj.decode('utf-8', 'ignore')
+        try:
+            obj = obj.decode('utf-8')
+        except UnicodeDecodeError, e:
+            logging.warn('error decoding "%s" (%s).' % (repr(obj), e))
+            obj = obj.decode('utf-8', 'ignore')
     return obj
 
 def filter_articles(names, articles, issues,