'Unescape a string in NodeJS

I have an input which is: %u05D0%u05DC%20%u05E2%u05DC

When I run the built-in browser function (on the console for example): unescape("%u05D0%u05DC%20%u05E2%u05DC")

The result is: "אל על"

When I run the same thing in NodeJS using the unescape module, the returned string is the same as original. Also tried to use the querystring.unescape function, but the same result.

Is there a way to imitate the same decoding functionality I got from the browser in a NodeJS application?

Thanks!



Solution 1:[1]

Node doesn't require any specific library to perform basic JavaScript operations. Besides, behind Chrome and Node there is the same JS engine V8. So as I commented you can use directly unescape.

Solution 2:[2]

You can use decodeURIComponent instead of unescape.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Diego
Solution 2 Christopher Reece