[erlang-questions] idea: include percent encoding functions in stdlib

Tim Fletcher twoggle@REDACTED
Mon Jan 26 12:57:11 CET 2009


As far as i can tell there are no routines in the standard library
for percent encoding/decoding (aka URL/URI encoding/decoding).

There would appear to be two encodings that are useful:

  1) RFC 3986 (the current URI spec)

  2) application/x-www-form-urlencoded (as per RFC 1738,
      except for that space characters are replaced by '+')


There are numerous existing Erlang implementations already in use,
including mochiweb_util, yaws_api, ibrowse_lib, and oauth_uri
(disclaimer:
i wrote the last one). There are others (such as erlydtl and smak)
which
appear to be based on the mochiweb code.

>From my testing, neither mochiweb_util or yaws_api implement either of
the above encodings correctly, ibrowse_lib correctly implements the
second
encoding, oauth_uri correctly implements the first encoding, and
ibrowse
is faster than all the other implementations.

Code is available to view/download here:

  http://github.com/tim/erlang-percent-encoding


This includes the four existing implementations above, plus an
additional
implementation based on ibrowse_lib which implements both encodings.

I would be grateful for any feedback on this. Does such a proposal
warrant
an EEP? Are my tests correct? Any other thoughts?



More information about the erlang-questions mailing list