Encode a wider range of unicode characters when inserting a note
This commit is contained in:
parent
d530d9cf95
commit
6ac663a002
1 changed files with 7 additions and 3 deletions
|
@ -1550,9 +1550,13 @@ Zotero.Integration.Session.prototype._processNote = async function (item) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Encode unicode chars
|
// Encode unicode chars
|
||||||
text = text.replace(/[\u00A0-\u9999]/gim, function (i) {
|
let value = '';
|
||||||
return '&#'+i.charCodeAt(0)+';';
|
for (let char of text) {
|
||||||
});
|
let code = char.codePointAt(0);
|
||||||
|
value += code > 127 ? '&#' + code + ';' : char;
|
||||||
|
}
|
||||||
|
text = value;
|
||||||
|
|
||||||
if (!text.startsWith('<html>')) {
|
if (!text.startsWith('<html>')) {
|
||||||
text = `<html><body>${text}</body></html>`;
|
text = `<html><body>${text}</body></html>`;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue