http_uri:encode not quoting control characters

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

http_uri:encode not quoting control characters

Mikl Kurkov
Hi,

just figured out that http_uri:encode function doesn't percent-encode control characters, like this:

```
http_uri:encode("new\nlines\nhere").
"new\nlines\nhere"
```

RFC3986 (https://www.ietf.org/rfc/rfc3986.txt) states that:

A percent-encoding mechanism is used to represent a data octet in a
   component when that octet's corresponding character is outside the
   allowed set or is being used as a delimiter of, or within, the
   component.

Characters that are allowed in a URI but do not have a reserved
   purpose are called unreserved.  These include uppercase and lowercase
   letters, decimal digits, hyphen, period, underscore, and tilde.

      unreserved  = ALPHA / DIGIT / "-" / "." / "_" / "~"

So it looks like control characters are not allowed in URI and should be encoded.
I wonder why http_uri behaves like this, is it intentional?

Erlang 17.5.3
--
Mikl

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions