[erlang-questions] url query string encode/decode

Caragea Silviu silviu.cpp@REDACTED
Fri Dec 15 11:55:41 CET 2017


Seems parsing of lists is not compliant. I see lot of libraries using
different implementations in different languages.
Anyway I solved my problem

Thanks a lot,
Silviu

On Fri, Dec 15, 2017 at 11:00 AM, Krzysztof Jurewicz <
krzysztof.jurewicz@REDACTED> wrote:

> > 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}]
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20171215/96e8aadb/attachment.htm>


More information about the erlang-questions mailing list