Elixir: URI.encode Will not Encode URL

Created on 13 Mar 2017  路  3Comments  路  Source: elixir-lang/elixir

Environment

Elixir 1.4.2, Erlang 19.2
Ubuntu 16.10

Current behavior

URI.encode("http://www.brookstone.com/pd/fitbit-charge-2-heart-rate-and-fitness-wristband/320397p.html")

Returns

"http://www.brookstone.com/pd/fitbit-charge-2-heart-rate-and-fitness-wristband/320397p.html"

Expected behavior

URI.encode("http://www.brookstone.com/pd/fitbit-charge-2-heart-rate-and-fitness-wristband/320397p.html")

Should Return

"http%3A%2F%2Fwww.brookstone.com%2Fpd%2Ffitbit-charge-2-heart-rate-and-fitness-wristband%2F320397p.html"

and furthermore If I run the URL through :http_uri.encode it returns the expected output.

:http_uri.encode 'http://www.brookstone.com/pd/fitbit-charge-2-heart-rate-and-fitness-wristband/320397p.html'
'http%3A%2F%2Fwww.brookstone.com%2Fpd%2Ffitbit-charge-2-heart-rate-and-fitness-wristband%2F320397p.html'

Most helpful comment

Please see encode_www_form.

Jos茅 Valim
www.plataformatec.com.br
Skype: jv.ptec
Founder and Director of R&D

All 3 comments

Please see encode_www_form.

Jos茅 Valim
www.plataformatec.com.br
Skype: jv.ptec
Founder and Director of R&D

Thanks @josevalim I missed that.

Thanks for filing an issue. The docs have also been improved.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cmeiklejohn picture cmeiklejohn  路  3Comments

ericmj picture ericmj  路  3Comments

LucianaMarques picture LucianaMarques  路  3Comments

lukaszsamson picture lukaszsamson  路  3Comments

whitepaperclip picture whitepaperclip  路  3Comments