nanterre: encode le contenu XML encapsulé de SAGA en latin1 si nécessaire (fixes #18712)

This commit is contained in:
Benjamin Dauvergne 2017-09-14 15:45:57 +02:00
parent 0c2c4090a2
commit 473608befc
1 changed files with 6 additions and 1 deletions

View File

@ -82,7 +82,12 @@ class Saga(object):
if content_node is None:
return None, u'SAGA no content node: %r' % response.content[:1024]
# pluging XML inside XML is so stupid :(
tree = ET.fromstring(content_node.text.encode('utf-8'))
content = content_node.text
if 'ISO-8859-1' in content:
encoded_content = content.encode('latin1')
else:
encoded_content = content.encode('utf-8')
tree = ET.fromstring(encoded_content)
if tree.tag == 'erreur':
return None, u'SAGA erreur: %s' % tree.text