Fix unescape function?

This commit is contained in:
Neale Pickett 2022-06-09 16:20:11 -06:00
parent 074cb7784a
commit d569b2b448
2 changed files with 2 additions and 1 deletions

View File

@ -86,7 +86,7 @@ function CString(buf, includeNull=false) {
* @returns {String} Unescaped string
*/
function Unescape(str) {
return str.replaceAll(/\\x([0-9]+)/g, (_, p1) => String.fromCharCode(p1))
return str.replaceAll(/\\x?([0-9a-fA-F]+)/g, (_, p1) => String.fromCharCode(parseInt(p1, 16)))
}
export {Stringify, Hexlify, Unhexlify, CString, Unescape}

1
run.sh
View File

@ -1,3 +1,4 @@
#! /bin/sh
echo 'http://localhost:8081'
busybox httpd -fv -p 8081 -c httpd.conf