The encoding name a part's XML declaration must name for the bytes it is
written in.
For a UTF-8 part it is UTF-8. For a UTF-16 part with a byte order mark it
is UTF-16, as the mark says which way round the bytes are. For a UTF-16
part without one it is UTF-16LE or UTF-16BE: XML 1.0 ยง4.3.3 requires
the mark of an entity declared UTF-16, so without it only the
declaration can name the byte order (#878). serializeXml writes it
into the encoding pseudo-attribute of a declaration it adds or of one
that has it; a declaration without one keeps none (#888).
The encoding name a part's XML declaration must name for the bytes it is written in.
For a UTF-8 part it is
UTF-8. For a UTF-16 part with a byte order mark it isUTF-16, as the mark says which way round the bytes are. For a UTF-16 part without one it isUTF-16LEorUTF-16BE: XML 1.0 ยง4.3.3 requires the mark of an entity declaredUTF-16, so without it only the declaration can name the byte order (#878). serializeXml writes it into theencodingpseudo-attribute of a declaration it adds or of one that has it; a declaration without one keeps none (#888).