fix: weird unicode char

This commit is contained in:
anuraghazra
2020-07-24 23:35:20 +05:30
parent f9b14c9442
commit 2812ce0fd3
2 changed files with 12 additions and 5 deletions
+5 -3
View File
@@ -17,9 +17,11 @@ const renderError = (message) => {
// https://stackoverflow.com/a/48073476/10629172
function encodeHTML(str) {
return str.replace(/[\u00A0-\u9999<>&](?!#)/gim, function (i) {
return "&#" + i.charCodeAt(0) + ";";
});
return str
.replace(/[\u00A0-\u9999<>&](?!#)/gim, (i) => {
return "&#" + i.charCodeAt(0) + ";";
})
.replace(/\u0008/gim, "");
}
function kFormatter(num) {