I use NodeJS with Express, and when I use foreign characters in the URL, they automatically get the encoding.
How to decode it back to the original line?
Before calling NodeJS, I remove the characters.
So the line: ΧΧΧΧΧ
Becomes %u05D0%u05D5%u05D1%u05DE%u05D4
Now the whole URL looks like this: http://localhost:32323/?query=%u05D0%u05D5%u05D1%u05DE%u05D4
Now in my NodeJS I get the escape string %u05D0%u05D5%u05D1%u05DE%u05D4 .
This is the corresponding code:
var url_parts = url.parse(req.url, true); var params = url_parts.query; var query = params.query;
I tried url and querystring , but nothing seems suitable to me.
querystring.unescape(query); // still '%u05D0%u05D5%u05D1%u05DE%u05D4'
Alexd source share