I’m trying to convert a string with URL::addEscapeChars and then call WebBrowserComponent::goToURL to open the URL. The problem is, the URL::addEscapeChars is escaping such normal things as slashes and colons. I have to be honest, I’m not certain what is technically in spec, but I can speak from experience and say that the string being output by addEscapeChars does not resolve correctly using the OSX WebBrowserComponent:
The following code:
String s = "file://My Path With Spaces In it/andAlsoSlashes.html";
LOG_DEBUG("%s%s", s.toUTF8(), "\n");
s = URL::addEscapeChars(s, false); // tried this with both true and false
LOG_DEBUG("%s%s", s.toUTF8(), "\n");
browser->goToURL(s);
Outputs the following on my machine:
[14:16:30] file://My Path With Spaces In it/andAlsoSlashes.html
[14:16:30] file%3a%2f%2fMy%20Path%20With%20Spaces%20In%20it%2fandAlsoSlashes.html
I was hoping it would output:
[14:16:30] file://My Path With Spaces In it/andAlsoSlashes.html
[14:16:30] file://My%20Path%20With%20Spaces%20In%20it/andAlsoSlashes.html
As I said, the string being returned to me now will not open in a WebBrowserComponent, whereas the the one that I was hoping for does.
Do I misunderstand the use of the URL::addEscapeChars()? Am I doing something dumb here? thanks in advance for any help