]> git.openstreetmap.org Git - osqa.git/blobdiff - forum_modules/exporter/exporter.py
SPLUNK-128, adding more padding to the content container, now it shouldn't cover...
[osqa.git] / forum_modules / exporter / exporter.py
index e9983d2002ba5963696acb53a759859b20e0a800..2db3ca232a71e3cc2c641b015dbffaaf7c1fb439 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import with_statement
+
 import os, tarfile, datetime, logging, re, ConfigParser, shutil, zipfile
 
 from django.core.cache import cache
@@ -91,8 +93,13 @@ def ET_Element_add_tag(el, tag_name, content = None, **attrs):
     if content:
         try:
             tag.text = unicode(content)
-        except:
-            tag.text = u''
+        except Exception, e:
+            logging.error('error converting unicode characters')
+            import traceback
+            logging.error(traceback.print_exc())
+
+            import string
+            tag.text = unicode("".join([c for c in content if c in string.printable]))
 
     for k, v in attrs.items():
         tag.set(k, unicode(v))