--- a/ext/rest.py Tue Jul 07 13:15:46 2009 +0200
+++ b/ext/rest.py Tue Jul 07 13:25:24 2009 +0200
@@ -29,7 +29,7 @@
from docutils.parsers.rst import Parser, states, directives
from docutils.parsers.rst.roles import register_canonical_role, set_classes
-from logilab.mtconverter import html_escape
+from logilab.mtconverter import ESC_UCAR_TABLE, ESC_CAR_TABLE, html_escape
from cubicweb.ext.html4zope import Writer
@@ -207,8 +207,12 @@
req = context.req
if isinstance(data, unicode):
encoding = 'unicode'
+ # remove unprintable characters unauthorized in xml
+ data = data.translate(ESC_UCAR_TABLE)
else:
encoding = req.encoding
+ # remove unprintable characters unauthorized in xml
+ data = data.translate(ESC_CAR_TABLE)
settings = {'input_encoding': encoding, 'output_encoding': 'unicode',
'warning_stream': StringIO(), 'context': context,
# dunno what's the max, severe is 4, and we never want a crash