diff --git a/chrome/content/zotero/xpcom/integration.js b/chrome/content/zotero/xpcom/integration.js index d6ac518030..80b9f8ba0e 100644 --- a/chrome/content/zotero/xpcom/integration.js +++ b/chrome/content/zotero/xpcom/integration.js @@ -1550,9 +1550,13 @@ Zotero.Integration.Session.prototype._processNote = async function (item) { } } // Encode unicode chars - text = text.replace(/[\u00A0-\u9999]/gim, function (i) { - return '&#'+i.charCodeAt(0)+';'; - }); + let value = ''; + for (let char of text) { + let code = char.codePointAt(0); + value += code > 127 ? '&#' + code + ';' : char; + } + text = value; + if (!text.startsWith('')) { text = `${text}`; }