URI encoding of '+' character

73 views
Skip to first unread message

Nathan Leniz

unread,
Nov 21, 2015, 11:55:57 PM11/21/15
to elixir-lang-talk
I noticed while sending some queries to wolfram that certain strings were producing garbage results. I've narrowed it down to URI.encode.

iex(2)> URI.encode("what is 9 * 5 + 5?")

"what%20is%209%20*%205%20+%205?"


This should be:

"what%20is%209%20*%205%20%2B%205%3F", shouldn't it?

José Valim

unread,
Nov 22, 2015, 3:23:03 AM11/22/15
to elixir-l...@googlegroups.com
You want to use URI.encode_www_form. URIs have different encoding rules depending on which part of the URI you are encoding.



José Valim
Skype: jv.ptec
Founder and Director of R&D

--
You received this message because you are subscribed to the Google Groups "elixir-lang-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-ta...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-talk/194e38a8-023d-49b3-8878-cea7c2514793%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

José Valim

unread,
Nov 23, 2015, 2:37:28 AM11/23/15
to elixir-l...@googlegroups.com
Use URI.encode_www_form. URIs have different encoding rules depending on what part you are encoding.
--
You received this message because you are subscribed to the Google Groups "elixir-lang-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-ta...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-talk/194e38a8-023d-49b3-8878-cea7c2514793%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--

José Valim

unread,
Nov 23, 2015, 3:06:16 AM11/23/15
to elixir-l...@googlegroups.com
Use URI.encode_www_form. URIs have different encoding rules depending on what part you are encoding.

On Sunday, November 22, 2015, Nathan Leniz <teraki...@gmail.com> wrote:
--
You received this message because you are subscribed to the Google Groups "elixir-lang-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-ta...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-talk/194e38a8-023d-49b3-8878-cea7c2514793%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages