Hi there, I am currently facing an issue with encoding while creating a document using JavaScript. The problem is that the document rejects all non-ascii characters. For example, when passing the string "verificación", it gets replaced by "". Any suggestions on how to fix this?
Below is the code snippet causing the issue:
function createDoc(string){
if (window.DOMParser)
{
parser = new DOMParser();
doc = parser.parseFromString('<?xml version="1.0" encoding="UTF-8"?>'+string, "text/xml");
}
else // Internet Explorer
{
doc = new ActiveXObject("Microsoft.XMLDOM");
doc.async = "false";
doc.loadXML('<?xml version="1.0" encoding="UTF-8"?>'+string);
}
return doc
}
Thank you in advance for any assistance provided.