August 9, 2011

QtQueries QtQueries
Lab Rat
10 posts

Qt.openUrlExternally() sometimes works on Symbian^3 and sometimes not, why is this?

 

I am having some difficulty with

  1. Qt.openUrlExternally
on Symbian^3. Sometimes it works, sometimes not, and I can’t find any pattern to it.

Another user seems to be having the same problem here.

When it does not work, the actual behaviour is that a web browser opens, comes to the foreground briefly (for a few seconds), then goes to the background. It is still open, but the URL does not load.

  1. Qt.openUrlExternally("http://www.nokia.com")
works.

  1. Qt.openUrlExternally("http://twitter.com/share?text=ZOMG")
fails. I initially concluded that this meant any URL with ? does not work, however this is wrong because…

  1. Qt.openUrlExternally("http://twitter.com/intent/tweet?text=ZOMG")
works. However, it seems to work for one word only because:

  1. Qt.openUrlExternally("http://twitter.com/intent/tweet?text=Will this work")
fails.

Has anyone encountered a similar issue (specifically for sending arbitrary text to Twitter I suppose), and what have they done about it?

4 replies

August 9, 2011

Volker Volker
Ant Farmer
5331 posts

replace the spaces by + signs, that’s the usual way to encode URL queries.

August 9, 2011

QtQueries QtQueries
Lab Rat
10 posts

Hmm.

I had already passed my URL through Javascript’s encodeURI() function, so the actual string was http://twitter.com/intent/tweet?text=Will(percent20)this(percent20)work — the forum code block option changed it to a space for me.

However, replacing the (percent20)‘s with +‘s in the final URL does in fact work. Surely is the standard replacement for spaces? What if the URI parameter includes a plus sign?

experiments

So, the following works OK: http://twitter.com/intent/tweet?text=Will+this+(percent2B)+work.

I conclude from this that any URI parameters should be passed through Javascript’s encodeURIComponent() function, with any (percent20)‘s on the resulting string replaced with +‘s.

By this reasoning I see also that I was wrong in my second assertion above, “http://twitter.com/share?text=ZOMG” does work OK.

Seems like a bug to me that (percent20) does not work, however this is what the Javascript encode functions use for space.

Thanks for the help.

EDITED to replace (percent20) which this damn forum software always actually substitutes for a space.

August 9, 2011

Lukas Geyer Lukas Geyer
Lab Rat
2068 posts

As a workaround wrap text you do not want to be substituted within @ tags.

August 10, 2011

QtQueries QtQueries
Lab Rat
10 posts

Hi.

I did that the first time, it substituted percent20 for space.

  1. typing percent20 HERE --> <--

 
  ‹‹ [Solved] Padding to listview/gridview      [SOLVED]showing a Random words and sentences in a QML ››

You must log in to post a reply. Not a member yet? Register here!