In cases like this xml code:
<string name="app_name">"OpenKeychain"</string>
<!-- title -->
<string name="title_encrypt_text">"Encrypt"</string>
tostring() returns trailing whitespaces (including newlines). Which
aren't removed until the very end, after we try to remove enclosing
quotes. So strip right after tostring() too, since we never really care
about whitespaces anyway.
def element_content(element):
if element.text is None:
return ""
- return XMLElementTree.tostring(element, encoding='utf-8', method='text')
+ s = XMLElementTree.tostring(element, encoding='utf-8', method='text')
+ return s.strip()
for path in xmlfiles:
if not os.path.isfile(path):