fix: file sprcial char

This commit is contained in:
archer
2023-08-26 21:17:57 +08:00
parent 4973d7ad9c
commit 0d26b1d48e
8 changed files with 41 additions and 29 deletions

View File

@@ -282,9 +282,7 @@ export const simpleText = (text: string) => {
text = text.replace(/\n{2,}/g, '\n');
text = text.replace(/\s{2,}/g, ' ');
text = text.replace(/\\x([0-9A-Fa-f]{2})/g, function (match, hex) {
return String.fromCharCode(parseInt(hex, 16));
});
text = text.replace(/[\x00-\x1F]/g, ' ');
return text;
};