Commit f568830b authored by Michal Čihař's avatar Michal Čihař

Encode to utf-8 before parsing XML

parent 95f7e01d
...@@ -678,7 +678,7 @@ class XMLTagsCheck(TargetCheck): ...@@ -678,7 +678,7 @@ class XMLTagsCheck(TargetCheck):
return False return False
# Check if source is XML # Check if source is XML
try: try:
source_tree = ElementTree.fromstring('<weblate>%s</weblate>' % source) source_tree = ElementTree.fromstring('<weblate>%s</weblate>' % source.encode('utf-8'))
source_tags = [x.tag for x in source_tree.iter()] source_tags = [x.tag for x in source_tree.iter()]
self.set_cache(unit, source_tags) self.set_cache(unit, source_tags)
except: except:
...@@ -688,7 +688,7 @@ class XMLTagsCheck(TargetCheck): ...@@ -688,7 +688,7 @@ class XMLTagsCheck(TargetCheck):
# Check target # Check target
try: try:
target_tree = ElementTree.fromstring('<weblate>%s</weblate>' % target) target_tree = ElementTree.fromstring('<weblate>%s</weblate>' % target.encode('utf-8'))
target_tags = [x.tag for x in target_tree.iter()] target_tags = [x.tag for x in target_tree.iter()]
except: except:
# Target is not valid XML # Target is not valid XML
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment