Reports: Don't strip valid surrogate pairs

Without the /u (Unicode) flag, [\ud800-\udfff] matches *all* surrogate pair code
points, even when they're in a valid position in the string.

Fixes #3421
This commit is contained in:
Abe Jellinek 2023-09-21 13:19:02 -04:00
parent 220eba8c63
commit 9779c70915

View file

@ -328,7 +328,7 @@ Zotero.Report.HTML = new function () {
var escapeXML = function (str) {
str = str.replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f\ud800-\udfff\ufffe\uffff]/g, '\u2B1A');
str = str.replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f\ud800-\udfff\ufffe\uffff]/gu, '\u2B1A');
return Zotero.Utilities.htmlSpecialChars(str);
}
}