From 023e61c01ea2091ac888bda48046a7b023a2bd57 Mon Sep 17 00:00:00 2001 From: lxsang Date: Wed, 17 Jun 2020 23:56:08 +0200 Subject: [PATCH] fix unescape --- src/core/core.ts | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/core/core.ts b/src/core/core.ts index f1d1aa1..0a7734d 100644 --- a/src/core/core.ts +++ b/src/core/core.ts @@ -659,19 +659,8 @@ namespace OS { }); }; String.prototype.unescape = function (): string { - let d = this; - d = d.replace(/\\\\/g, "\\"); - d = d.replace(/\\"/g, '"'); - d = d.replace(/\\'/g, "'"); - d = d.replace(/\\%/g, '%'); - d = d.replace(/\\0/g, "\0"); - d = d.replace(/\\n/g, "\n"); - d = d.replace(/\\t/g, "\t"); - d = d.replace(/\\b/g, "\b"); - d = d.replace(/\\f/g, "\f"); - d = d.replace(/\\r/g, "\r"); - d = d.replace(/\\z/g, "\x1a"); - return d; + let json = JSON.parse(`{ "text": "${this}"}`) + return json.text; }; String.prototype.asUint8Array = function (): Uint8Array { let bytes = [];