Load all files xpcom/ files as UTF-8
This fixes corrupted em dashes from citeproc-js: https://forums.zotero.org/discussion/78327/dash-in-ama-is-producing-odd-characters-a%C2%80%C2%94
This commit is contained in:
parent
f6f2faf675
commit
66f2d177a9
1 changed files with 7 additions and 7 deletions
|
@ -261,11 +261,11 @@ function makeZoteroContext(isConnector) {
|
||||||
var subscriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci.mozIJSSubScriptLoader);
|
var subscriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci.mozIJSSubScriptLoader);
|
||||||
|
|
||||||
// Load zotero.js first
|
// Load zotero.js first
|
||||||
subscriptLoader.loadSubScript("chrome://zotero/content/xpcom/" + xpcomFilesAll[0] + ".js", zContext);
|
subscriptLoader.loadSubScript("chrome://zotero/content/xpcom/" + xpcomFilesAll[0] + ".js", zContext, 'utf-8');
|
||||||
|
|
||||||
// Load CiteProc into Zotero.CiteProc namespace
|
// Load CiteProc into Zotero.CiteProc namespace
|
||||||
zContext.Zotero.CiteProc = {"Zotero":zContext.Zotero};
|
zContext.Zotero.CiteProc = {"Zotero":zContext.Zotero};
|
||||||
subscriptLoader.loadSubScript("chrome://zotero/content/xpcom/citeproc.js", zContext.Zotero.CiteProc);
|
subscriptLoader.loadSubScript("chrome://zotero/content/xpcom/citeproc.js", zContext.Zotero.CiteProc, 'utf-8');
|
||||||
|
|
||||||
// Load XRegExp object into Zotero.XRegExp
|
// Load XRegExp object into Zotero.XRegExp
|
||||||
const xregexpFiles = [
|
const xregexpFiles = [
|
||||||
|
@ -286,13 +286,13 @@ function makeZoteroContext(isConnector) {
|
||||||
'addons/unicode/unicode-zotero' //adds support for some Unicode categories used in Zotero
|
'addons/unicode/unicode-zotero' //adds support for some Unicode categories used in Zotero
|
||||||
];
|
];
|
||||||
for (var i=0; i<xregexpFiles.length; i++) {
|
for (var i=0; i<xregexpFiles.length; i++) {
|
||||||
subscriptLoader.loadSubScript("chrome://zotero/content/xpcom/xregexp/" + xregexpFiles[i] + ".js", zContext);
|
subscriptLoader.loadSubScript("chrome://zotero/content/xpcom/xregexp/" + xregexpFiles[i] + ".js", zContext, 'utf-8');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load remaining xpcomFiles
|
// Load remaining xpcomFiles
|
||||||
for (var i=1; i<xpcomFilesAll.length; i++) {
|
for (var i=1; i<xpcomFilesAll.length; i++) {
|
||||||
try {
|
try {
|
||||||
subscriptLoader.loadSubScript("chrome://zotero/content/xpcom/" + xpcomFilesAll[i] + ".js", zContext);
|
subscriptLoader.loadSubScript("chrome://zotero/content/xpcom/" + xpcomFilesAll[i] + ".js", zContext, 'utf-8');
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
Components.utils.reportError("Error loading " + xpcomFilesAll[i] + ".js", zContext);
|
Components.utils.reportError("Error loading " + xpcomFilesAll[i] + ".js", zContext);
|
||||||
|
@ -303,7 +303,7 @@ function makeZoteroContext(isConnector) {
|
||||||
// Load xpcomFiles for specific mode
|
// Load xpcomFiles for specific mode
|
||||||
for (let xpcomFile of (isConnector ? xpcomFilesConnector : xpcomFilesLocal)) {
|
for (let xpcomFile of (isConnector ? xpcomFilesConnector : xpcomFilesLocal)) {
|
||||||
try {
|
try {
|
||||||
subscriptLoader.loadSubScript("chrome://zotero/content/xpcom/" + xpcomFile + ".js", zContext, "UTF-8");
|
subscriptLoader.loadSubScript("chrome://zotero/content/xpcom/" + xpcomFile + ".js", zContext, "utf-8");
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
dump("Error loading " + xpcomFile + ".js\n\n");
|
dump("Error loading " + xpcomFile + ".js\n\n");
|
||||||
|
@ -326,12 +326,12 @@ function makeZoteroContext(isConnector) {
|
||||||
];
|
];
|
||||||
zContext.Zotero.RDF = {Zotero:zContext.Zotero};
|
zContext.Zotero.RDF = {Zotero:zContext.Zotero};
|
||||||
for (var i=0; i<rdfXpcomFiles.length; i++) {
|
for (var i=0; i<rdfXpcomFiles.length; i++) {
|
||||||
subscriptLoader.loadSubScript("chrome://zotero/content/xpcom/" + rdfXpcomFiles[i] + ".js", zContext.Zotero.RDF);
|
subscriptLoader.loadSubScript("chrome://zotero/content/xpcom/" + rdfXpcomFiles[i] + ".js", zContext.Zotero.RDF, 'utf-8');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isStandalone()) {
|
if(isStandalone()) {
|
||||||
// If isStandalone, load standalone.js
|
// If isStandalone, load standalone.js
|
||||||
subscriptLoader.loadSubScript("chrome://zotero/content/xpcom/standalone.js", zContext);
|
subscriptLoader.loadSubScript("chrome://zotero/content/xpcom/standalone.js", zContext, 'utf-8');
|
||||||
}
|
}
|
||||||
|
|
||||||
// add connector-related properties
|
// add connector-related properties
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue