I'm using the deprecated unescape
function in one of my program.
The protocol I'm working with sends escape
d binary strings via the query string. So on their side they are doing something along the lines of (0-9, a-z, A-Z, '.', '-', '_' and '~' are encoded using the "%nn" format):
var source = "\x12\x34\x56\x78\x9a\xbc\xde\xf1\x23\x45\x67\x89\xab\xcd\xef\x12\x34\x56\x78\x9a";
var encoded = escape(source);
// escaped is now "%124Vx%9A%BC%DE%F1%23Eg%89%AB%CD%EF%124Vx%9A"
So I'm receiving this string on my end and I have to decode it. decodeURIComponent
is not working in this case so I rely on unescape
:
var received = "%124Vx%9A%BC%DE%F1%23Eg%89%AB%CD%EF%124Vx%9A";
var binaryString = unescape(received);
Since unescape
is deprecated, any pointers on how should I decode these binary strings?
Note: querystring.unescape
doesn't work either...