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:
parent
b9fb7fa3c6
commit
06615f738f
|
@ -404,7 +404,7 @@ Zotero.Translate.SandboxManager = function(sandboxLocation) {
|
||||||
this.__exposedProps__ = {"parseFromString":"r"};
|
this.__exposedProps__ = {"parseFromString":"r"};
|
||||||
this.parseFromString = function(str, contentType) {
|
this.parseFromString = function(str, contentType) {
|
||||||
var xhr = sandbox.XMLHttpRequest();
|
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();
|
xhr.send();
|
||||||
if (!xhr.responseXML) throw new Error("error parsing XML");
|
if (!xhr.responseXML) throw new Error("error parsing XML");
|
||||||
return xhr.responseXML;
|
return xhr.responseXML;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user