epub: a2x corrupts content.opf when using non ascii-encoding
Brought to you by:
sjrackham
I'm using version 8.6.8 on windows.
When creating epub documents a2x crashes when rewriting the file content.opf and if the original produced file (by xslt-transformation) contains non-ascii encoded strings.
I suggest to change the following line in update_epub_manifest() in a2x.py line 760
write_file(opf_file, opf.toxml(opf.encoding), mode="wb")
or
write_file(opf_file, opf.toprettyxml(indent=" ", encoding=opf.encoding), mode="wb")
This preserves the encoding attribute of the parsed opf file. The mode "wb" avoids an exception on Windows when writing a non ascii encoded string to a file and dows no harm on unix like systems.