Fix unescape function?
This commit is contained in:
parent
074cb7784a
commit
d569b2b448
|
@ -86,7 +86,7 @@ function CString(buf, includeNull=false) {
|
||||||
* @returns {String} Unescaped string
|
* @returns {String} Unescaped string
|
||||||
*/
|
*/
|
||||||
function Unescape(str) {
|
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}
|
export {Stringify, Hexlify, Unhexlify, CString, Unescape}
|
||||||
|
|
Loading…
Reference in New Issue