This commit is contained in:
Kovid Goyal 2012-10-21 15:19:16 +05:30
parent 93b2f860f9
commit c8358bb266

View File

@ -379,6 +379,10 @@ def set_metadata(stream, mi, apply_null=False, update_timestamp=False):
stream.seek(0) stream.seek(0)
stream.truncate() stream.truncate()
# Apparently there exists FB2 reading software that chokes on the use of
# single quotes in xml declaration. Sigh. See
# http://www.mobileread.com/forums/showthread.php?p=2273184#post2273184
stream.write(b'<?xml version="1.0" encoding="UTF-8"?>\n')
stream.write(etree.tostring(root, method='xml', encoding='utf-8', stream.write(etree.tostring(root, method='xml', encoding='utf-8',
xml_declaration=True)) xml_declaration=False))