Encode text back into a part's own encoding, restoring the byte order mark
a UTF-16 part carried.
The counterpart of decodeXmlPart: a part read as UTF-16LE with a
BOM is written back as UTF-16LE with a BOM, never transcoded to UTF-8. A
UTF-8 part is written without one, as every writer wrote it before #866:
XML requires the mark only of UTF-16 (XML 1.0 ยง4.3.3).
Encode text back into a part's own encoding, restoring the byte order mark a UTF-16 part carried.
The counterpart of decodeXmlPart: a part read as UTF-16LE with a BOM is written back as UTF-16LE with a BOM, never transcoded to UTF-8. A UTF-8 part is written without one, as every writer wrote it before #866: XML requires the mark only of UTF-16 (XML 1.0 ยง4.3.3).