ShowURL does not work long URL

I have this working url:
"https://myserver.com/arsys/forms/my-backend/SHR:LandingBack/Default+Admin+View/?mode=modify&F304255500=MMS:MyID&F1000000076=FormOpen&F303647600=SearchID&F304255610=‘1’=“MAS100000289442”

Now I would open this with ShowRL(url):
dim url as string = "https://myserver.com/arsys/forms/my-backend/SHR:LandingBack/Default+Admin+View/?mode=modify&F304255500=MMS:MyID&F1000000076=FormOpen&F303647600=SearchID&F304255610=‘1’=“MAS100000289442”
Firefox is starting, but the url will not shown. I the url field of firefox in only a shorter string:
https://myserver.com/arsys/forms/my-backend/SHR:LandingBack/Default+Admin+View/?mode=modify&
When I copy the url like this:
dim MyClip as new clipboard
MyClip.text = url
And paste the clipboard into Firefox, the url will be shown. I also try to convert the url string with “url = DecodeURLComponent(url)”, but this also does not work.

You have to escape the double quotes:

... 10='1'="MAS100000289442"

… should be:

... 10='1'=""MAS100000289442""

I just tried with a very long URL ; no problems with Firefox on Mac or Windows.

http://fontmenu.com/?yada1=toto&yada2=toto&yada3=toto&yada4=toto&yada5=toto&yada6=toto&yada7=toto&yada8=toto&yada9=toto&yada10=toto&yada11=toto&yada12=toto&yada13=toto&yada14=toto&yada15=toto&yada16=toto&yada17=toto&yada18=toto&yada19=toto&yada20=toto

I have changed the string
10=‘1’="“MAS100000289442"”
to
10=‘1’=%22MAS100000289442%22"
And now it works.

EncodeURLComponent is your friend

Use it for each of the components in the URL and they will be escaped properly.

Something like
Dim QuotedString as String = “”“QuotedString”"" ’ = “QuotedString”

dim url as string

url = “http://myserver/?yada1="+EncodeURLComponent("Spaced String”)+"&yada2="+EncodeURLComponent(QuotedString)

url = http://myserver/?yada1=Spaced%20String&yada2="QuotedString"

It is much easier to encodeURLComponent the whole URL string. If it is already escaped, it will not hurt.

That wouldn’t work with items containing quotes, equals, ampersands, semicolons, or anything else containing special html chars

Encoding the individual parts means that the server can use Request.GET(“item”) and correctly get the part of the URL with item=%22Quoted%22 to give item = “Quoted”

dim vendor as string = “Marks & Spenders”
dim year as string = “2015”
dim url as string = “http://myserverurl/?"
dim arg as string = “vendor=”+EncodeURLComponent(vendor)+”&year="+EncodeURLComponent(year)
ShowURL(url+arg)

http://myserverurl/?vendor=Marks%20%26%20Spenders&year=2015

At the server end, Request.get(“vendor”) correctly gives Marks & Spenders

If you encoded the whole thing how would you be able to separate each part out?
arg=EncodeURLComponent(“vendor=”+vendor+"&year="+year)
ShowURL(url+arg)

http://myserverurl/?vendor%3DMarks%20%26%20Spenders%26year%3D2015

Lee

[quote=222970:@Lee Badham]If you encoded the whole thing how would you be able to separate each part out?
arg=EncodeURLComponent(“vendor=”+vendor+"&year="+year)
ShowURL(url+arg)[/quote]

Just try. A URL encoded URL is decoded automatically by any Web app, and even the most elementary HTML page. Encoding individually each parameter is unnecessary extra work.

It did not work when I used Xojo Web edition.

Web app with in the HandleSpecialURL

Request.Print request.GetParameter(“vendor”)
Request.Print request.GetParameter(“year”)
return true

Encoding each part gives
http://localhost:8080/special/?vendor=Marks%20%26%20Spenders&year=2015

And correctly outputs Marks & Spenders2015

Encoding the whole string gives
http://localhost:8080/special/?vendor%3DMarks%20%26%20Spenders%26year%3D2015

This gives me nothing

Lee

I thought you were referring to a normal app, where it works perfectly, as expected.

In HandleSpecialURL indeed it does not work. That is a bug IMO.