Fix parsing of Unicode capa XML BOM-611 (#21803)

This commit is contained in:
Jeremy Bowman
2019-09-26 16:34:35 -04:00
committed by GitHub
parent a847620e88
commit 1e3d6f6db3

View File

@@ -185,6 +185,9 @@ class LoncapaProblem(object):
self.problem_text = problem_text
# parse problem XML file into an element tree
if isinstance(problem_text, six.text_type):
# etree chokes on Unicode XML with an encoding declaration
problem_text = problem_text.encode('utf-8')
self.tree = etree.XML(problem_text)
self.make_xml_compatible(self.tree)