eea / odfpy

API for OpenDocument in Python
GNU General Public License v2.0
308 stars 63 forks source link

OpenDocument.save unicode problem #43

Open raychin4563 opened 7 years ago

raychin4563 commented 7 years ago

Since OpenDocument.settingsxml() and OpenDocument.metaxml() return a unicode object, it will raise UnicodeEncodeError when running OpenDocument._saveXmlObjects(). The solution is to encode the unicode object in line 677 and 685 in opendocument.py.

line 677 self._z.writestr(zi, anObject.settingsxml() ) Change to self._z.writestr(zi, anObject.settingsxml().encode('utf8') )

line 685 self._z.writestr(zi, anObject.metaxml() ) Change to self._z.writestr(zi, anObject.metaxml().encode('utf8') )

icemac commented 7 years ago

@raychin4563 Cloud you create a pull request for these changes?