[erlang-questions] url query string encode/decode
Krzysztof Jurewicz
krzysztof.jurewicz@REDACTED
Fri Dec 15 10:00:56 CET 2017
> There is any library that allows you to encode a proplist into a query
> string and the other way around.
>
> Most of libraries I saw are not working because for example lists of
> properties are failing like:
>
> [{<<"a">>, [1,2,3]}]
cowlib’s cow_qs:parse_qs/1 and cow_qs:qs/1 should do the job:
3> cow_qs:parse_qs(<<"a=b&a=c">>).
[{<<"a">>,<<"b">>},{<<"a">>,<<"c">>}]
4> cow_qs:qs(cow_qs:parse_qs(<<"a=b&a=c">>)).
<<"a=b&a=c">>
5> cow_qs:parse_qs(<<"a=b&c">>).
[{<<"a">>,<<"b">>},{<<"c">>,true}]
More information about the erlang-questions
mailing list