Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Level 13

Caret in URL

I have to use a caret (^) in a URL, but when I try it I get back the CURLE_URL_MALFORMAT error code (-3) and GetFailureReason() returns "No URL set!". I thought I could just replace the caret with %5E, but the site I'm trying to connect to doesn't seem to support that syntax. Any ideas?

-JT
0 Kudos
13 Replies
Highlighted
Level 9

Re: Caret in URL

Try encoding your url with:


o = CreateObject("roUrlTransfer")
encodedUrl = o.Escape(url)


--Kevin
0 Kudos
Highlighted
Level 13

Re: Caret in URL

I tried both Escape() and UrlEncode() and they both return the CURLE_COULDNT_RESOLVE_HOST error (-6) after the call to AsyncGetToString(). GetFailureReason() returns "Could not resolve host:" followed by the modified URL followed by the message "(Misformatted domain name)". I don't think either would work for me anyway since the site I'm trying to access doesn't recognize % escapes, which is really annoying. I think I'm out of luck unless I can pass the caret through unmodified.

-JT
0 Kudos
Highlighted
Level 7

Re: Caret in URL

Is the ^ in a querystring value? If so, you might be able to post it as post data instead, depending on how liberal the code behind the site is...
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
Highlighted
Level 13

Re: Caret in URL

"TheEndless" wrote:
Is the ^ in a querystring value? If so, you might be able to post it as post data instead, depending on how liberal the code behind the site is...

Yes it is. I'll give that a try. Thanks for the idea!

Edit: I couldn't get it to work. I can't be sure if it doesn't accept the post or if I just haven't figured out exactly what to post to exactly what url.

-JT
0 Kudos
Highlighted
Level 7

Re: Caret in URL

For more than most people would ever want or need to know about URL obfuscation:
go here:
http://www.pc-help.org/obscure.htm
search for this line:
Example: http://usernameSmiley Tongueassword@www.whatever.c ... esonly.htm

between that trick of flipping the authentication information between the http:// and the @ symbol (example above this) and using hex or octal or some other numbering system (not %), then you should be able to come up with some alternate encoding.

Since I'm guessing what you're trying to do, (IN --> function --> OUT), I'm just taking a shot in the dark here.

--
good luck
0 Kudos
Highlighted
Level 13

Re: Caret in URL

Thanks. That was some interesting reading, but it doesn't help my situation which is a query sent to a url like this:
http://www.someplace.com/query/1.0?q=^parm

The site won't accept the caret being replaced by %5E and the Roku box won't send the caret.

-JT
0 Kudos
Highlighted
Level 7

Re: Caret in URL

Well, it doesn't help you solve your problem, but it sounds like that web server is seriously nonconformant to web standards. According to RFC 1738, caret is an "unsafe character" and "All unsafe characters must always be encoded within a URL". Caret is listed as unsafe because is it in a set of characters that "gateways and other transport agents are known to sometimes modify". Again, this doesn't help you unless you can use it to apply pressure to get that server made more compliant.

--Mark
0 Kudos
Highlighted
Level 13

Re: Caret in URL

You're right, it doesn't help. :mrgreen: It's not a big deal, but it would be nice if there was a way to just let anything be allowed in a URL and let the connection succeed or fail on it's own.

The really funny thing is that it's a Yahoo server. You'd think they'd get it right.

-JT
0 Kudos
Highlighted
Level 7

Re: Caret in URL

This seems more of a standards issue. I don't think I've ever been to a website that used ^ as a character? Is there a reason that this is required?
0 Kudos