HTTP Get path. escaping characters?

282 views
Skip to first unread message

Ivan Fernandez

unread,
Aug 11, 2013, 4:20:12 PM8/11/13
to tas...@googlegroups.com
Ni there!,

I'm trying to get an HTTP URL path that contains plus and percent symbols, bit can't seem to find the way to escape them correctly un the path field for the action. I'm getting blanks on the server side for each % ir + symbol I send. Muy simplest url is something like "tv_light_40%" without the quot. marks, but I get tv_light_40 (no %) on the ser ver.... Anyone can point me what to do? Thanks!

Brandon Horwath

unread,
Aug 11, 2013, 7:18:42 PM8/11/13
to tas...@googlegroups.com
Have you tried using \ as an escape character?

Maybe try setting the escape value to a variable and using that in the path?

Kurt Milam

unread,
Aug 11, 2013, 7:31:45 PM8/11/13
to tas...@googlegroups.com
You must encode any percent sign used in a URI.

Here's what Wikipedia has to say on the subject: Because the percent ("%") character serves as the indicator for percent-encoded octets, it must be percent-encoded as "%25" for that octet to be used as data within a URI.

Source: http://www.wikipedia.org/wiki/Percent-encoding

Try tv_light%2540

Generally, it's best to avoid using the percent sign in your URIs, if possible.

Ivan Fernandez

unread,
Aug 12, 2013, 2:13:33 AM8/12/13
to tas...@googlegroups.com
Thanks Brandon, I've been trying to escape the characters with backslashes, with HTML ampersand_code_; and even inserting it through variables as well. No dice. But see Kurt's answer below your... That's the real deal and works like a charm!

Ivan Fernandez

unread,
Aug 12, 2013, 2:22:13 AM8/12/13
to tas...@googlegroups.com
Thanks a lot Kurt! Works perfectly. I wasn't aware URIs had to be coded that way for reserved characters. Also, you're right I better avoid using reserved/special characters in a URI, but that's an imposition of the home automation software (good ol' misterhouse) and I'd better not open a new front there...
Thanks again!
Reply all
Reply to author
Forward
0 new messages