I have the following code in order to remove ALL invalid Unicode characters before sending them in XML in a SOAP request.
const invalidUnicodeRemoved = inputText.replace(/[\u0000-\u001F]/gm, '');
However, I keep getting the following error sending the XML: An invalid XML character (Unicode: 0x1) was found in the element content of the document.
. So basically it has not been removed (or at least not all of them).
Any ideas?