Skip to content
This repository has been archived by the owner on Jun 15, 2019. It is now read-only.

Commit

Permalink
Encode XML to UTF8 before parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
codeinthehole committed Jul 30, 2013
1 parent d643daf commit 6320451
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion datacash/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

def prettify_xml(xml_str):
xml_str = re.sub(r'\s*\n\s*', '', xml_str)
ugly = parseString(xml_str).toprettyxml(indent=' ')
ugly = parseString(xml_str.encode('utf8')).toprettyxml(indent=' ')
regex = re.compile(r'>\n\s+([^<>\s].*?)\n\s+</', re.DOTALL)
return regex.sub('>\g<1></', ugly)

Expand Down

0 comments on commit 6320451

Please sign in to comment.