Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Don't encode urls in querystring stringify

Is there any option for qs.stringify that will not encode the urls?

$ node
> var qs = require("querystring");
undefined
> qs.stringify({"url": "http://domain.com"});
'url=http%3A%2F%2Fdomain.com'

I want the folowing output:

'url=http://domain.com'
like image 979
Ionică Bizău Avatar asked Aug 28 '13 18:08

Ionică Bizău


People also ask

Should I encode URL parameters?

Why do we need to encode? URLs can only have certain characters from the standard 128 character ASCII set. Reserved characters that do not belong to this set must be encoded. This means that we need to encode these characters when passing into a URL.

Is Querystring deprecated?

This package has been deprecated.

How do you encode and decode URL parameters in Java?

Encode the URL private String encodeValue(String value) { return URLEncoder. encode(value, StandardCharsets. UTF_8. toString()); } @Test public void givenRequestParam_whenUTF8Scheme_thenEncode() throws Exception { Map<String, String> requestParams = new HashMap<>(); requestParams.


1 Answers

It's a little late, but for the next person, you can do: querystring.unescape(myString)

like image 194
J-Dubya Avatar answered Nov 14 '22 22:11

J-Dubya