I'm using httpc:request
to post some data to a remote service. I have the post working but the data in the body() of the post comes through as is, without any URL-encoding which causes the post to fail when parsed by the remote service.
Is there a function in Erlang that is similar to CGI.escape
in Ruby for this purpose?
I encountered the lack of this feature in the HTTP modules as well.
It turns out that this functionality is actually available in the erlang distribution, you just gotta look hard enough.
This behaves like CGI.escape in Ruby, there is also URI.escape which behaves slightly differently:
edoc_lib
AFAIK there's no URL encoder in the standard libraries. Think I 'borrowed' the following code from YAWS or maybe one of the other Erlang web servers: