entities 9.0.0
const escape: typeof encodeXML

Defined in escape.ts:117

Encodes all non-ASCII characters, as well as characters not valid in XML documents using numeric decimal reference (eg. ü).

Have a look at escapeUTF8 if you want a more concise output at the expense of reduced transportability.