Bouke / docx-mailmerge

Mail merge for Office Open XML (docx) files without the need for Microsoft Office Word.
MIT License
273 stars 104 forks source link

Lxml etree serialzation io_encoder error workaround #99

Open sgniedoj opened 2 years ago

sgniedoj commented 2 years ago

Description

Adds "encoding" parameter to MailMerge.write

Motivation and Context

Calling MailMerge.write(file) occasionally causes lxml.etree.SerialisationError: IO_ENCODER exception. Adding encoding='UTF-8' to xml = etree.tostring(self.parts[zi].getroot(), encoding='UTF-8') eliminates the problem.

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

Checklist: