External encoding is valid after loading, and indicates the encoding detected in the external xml document. Internally, all string values are always encoded in UTF8, so if the external stream is Ansi with codepage or UTF16, a conversion is done. When writing to a file/stream, a BOM is generated for the two-byte character encodings (UTF16LE and UUTF16BE). UTF8 uses *no BOM* according to the XML specification. Any conversion is done from UTF8 to external encodings if necessary. You can *set* ExternalEncoding too but only for welldefined encodings (seUTF8, seUTF16LE, seUTF16BE). If you want to use an ansi encoding, then set
ExternalCodepage.