Tweak method for parsing XML without a window to handle UTF-8 properly

Fixes issue reported at https://forums.zotero.org/discussion/45556
This commit is contained in:
Simon Kornblith 2015-01-14 01:55:32 -05:00
parent b9fb7fa3c6
commit 06615f738f

View file

@ -404,7 +404,7 @@ Zotero.Translate.SandboxManager = function(sandboxLocation) {
this.__exposedProps__ = {"parseFromString":"r"};
this.parseFromString = function(str, contentType) {
var xhr = sandbox.XMLHttpRequest();
xhr.open("GET", "data:"+contentType+";base64,"+btoa(str), false);
xhr.open("GET", "data:"+contentType+";charset=utf-8,"+encodeURIComponent(str), false);
xhr.send();
if (!xhr.responseXML) throw new Error("error parsing XML");
return xhr.responseXML;