[erlang-questions] {erlang, aws} = erlawys.

Jesper Louis Andersen jesper.louis.andersen@REDACTED
Fri Aug 17 13:20:00 CEST 2007


On 8/17/07, Jeremy Thurgood <jerith@REDACTED> wrote:It looks like your
auth failures are

[hexify code]

Let me give my hexify version as well. I don't know which is most correct or
fastest. I am
mostly concerned about the correctness. According to RFC1738, you may
actually encode
everything, even unreserved characters, but there are parsers which fails if
you try that.

What characters are unreserved is given in RFC3986:

rfc_3986_unreserved_characters() ->
    "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.~".

rfc_3986_unreserved_characters_set() ->
    sets:from_list(rfc_3986_unreserved_characters()).

%%--------------------------------------------------------------------
%% Function: build_uri_encoded_form_rfc1738(List) -> String
%% Description: Convert the list into RFC1738 encoding (URL-encoding).
%%--------------------------------------------------------------------
build_uri_encoded_form_rfc1738(List) ->
    Unreserved = rfc_3986_unreserved_characters_set(),
    lists:flatten(lists:map(
            fun (E) ->
                case sets:is_element(E, Unreserved) of
                true ->
                    E;
                false ->
                    lists:concat(
                      ["%", io_lib:format("~2.16.0B", [E])])
                end
            end,
            List)).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20070817/16726748/attachment.htm>


More information about the erlang-questions mailing list