glifLib: writeGlyphToString must include the xml declaration

This is a regression from ufoLib v2.1.1, see

https://github.com/adobe-type-tools/afdko/pull/462#issuecomment-403577134
https://travis-ci.org/adobe-type-tools/afdko/jobs/401751859#L8427
This commit is contained in:
Cosimo Lupo 2018-07-09 20:12:21 +01:00
parent d01c383fe9
commit 8ad8f7631c
No known key found for this signature in database
GPG Key ID: 59D54DB0C9976482

View File

@ -628,7 +628,10 @@ def writeGlyphToString(glyphName, glyphObject=None, drawPointsFunc=None, formatV
_writeLib(glyphObject, root, validate) _writeLib(glyphObject, root, validate)
# return the text # return the text
tree = etree.ElementTree(root) tree = etree.ElementTree(root)
text = etree.tostring(root, encoding=unicode, pretty_print=True) data = etree.tostring(
root, encoding="utf-8", xml_declaration=True, pretty_print=True
)
text = data.decode("utf-8")
return text return text