diff --git a/node/utils/ExportHtml.js b/node/utils/ExportHtml.js
index 4cd4bbee..dce156ec 100644
--- a/node/utils/ExportHtml.js
+++ b/node/utils/ExportHtml.js
@@ -402,10 +402,16 @@ function _escapeHTML(s)
'>': '>',
};
}
- return s.replace(re, function (c)
+
+ s = s.replace(re, function (c)
{
return re.MAP[c];
});
+
+ return s.replace(/[^\x21-\x7E\s\t\n\r]/g, function(c)
+ {
+ return "" +c.charCodeAt(0) + ";"
+ });
}
// copied from ACE