Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
Zax
- Posts: 519
- Joined: Mon May 28, 2007 10:12 am
-
Contact:
Post
by Zax » Tue Jul 05, 2016 10:25 am
Hello,
I have to launch an URL with a tilde in it, somethinh like
https://ssl15.ovh.net/~myDomain/myPage.html but the tilde character is transformed into the string "LE8B3" by the browser. Then, of course, the server returns a 404 error.
I used this:
Code: Select all
put "https://ssl15.ovh.net/~myDomain/myPage.html" into myURL // just an example
launch url myURL
I tried this, but it doesn't work:
Code: Select all
put "https://ssl15.ovh.net/~myDomain/myPage.html" into myURL // just an example
put textEncode(myUrl,"UTF-8") into myURL
launch url myURL
What should I do? Sorry if is has been already discussed somewhere.
Thank tou for your help.
Last edited by
Zax on Fri Jul 08, 2016 9:36 pm, edited 1 time in total.
-
jmburnod
- VIP Livecode Opensource Backer

- Posts: 2729
- Joined: Sat Dec 22, 2007 5:35 pm
-
Contact:
Post
by jmburnod » Tue Jul 05, 2016 11:57 am
Hi zak,
You can try this.
Code: Select all
put "https://ssl15.ovh.net/" & urlencode("~myDomain") & "/myPage.html" into myUrl
Best regards
Jean-Marc
https://alternatic.ch
-
Zax
- Posts: 519
- Joined: Mon May 28, 2007 10:12 am
-
Contact:
Post
by Zax » Tue Jul 05, 2016 12:38 pm
jmburnod wrote:Hi zak,
You can try this.
Code: Select all
put "https://ssl15.ovh.net/" & urlencode("~myDomain") & "/myPage.html" into myUrl
Best regards
Jean-Marc
Thanks for your quick answer.
I tried your solution but the browser has a strange behaviour:

As it's a private domain, names have been changed on the screen capture but the interesting thing is that when I click into the browser's URL field and press the return key, it goes to the correct URL. But when I simply reload the page, it returns the same 404 error.
Any Idea?
-
jmburnod
- VIP Livecode Opensource Backer

- Posts: 2729
- Joined: Sat Dec 22, 2007 5:35 pm
-
Contact:
Post
by jmburnod » Tue Jul 05, 2016 5:46 pm
What about this ?
Code: Select all
put urlEncode(textEncode("~myDomain","utf8")) into tDomain
put "https://ssl15.ovh.net/" & tDomain & "/myPage.html" into myUrl
https://alternatic.ch
-
MaxV
- Posts: 1580
- Joined: Tue May 28, 2013 2:20 pm
-
Contact:
Post
by MaxV » Wed Jul 06, 2016 10:35 am
Mac OS encoding is MacRoman
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
-
Zax
- Posts: 519
- Joined: Mon May 28, 2007 10:12 am
-
Contact:
Post
by Zax » Wed Jul 06, 2016 12:46 pm
jmburnod wrote:What about this ?
Code: Select all
put urlEncode(textEncode("~myDomain","utf8")) into tDomain
put "https://ssl15.ovh.net/" & tDomain & "/myPage.html" into myUrl
I tried with "utf8" and "MacRoman" parameter but it stills doesn't work. The result in the same that shown in the posted screen capture.
I suppose I will have to use HTTP protocol, instead of HTTPS, in order to have a "regular" URL, without this damned tilde.
Anyhow, thanks for your suggestions.
-
jacque
- VIP Livecode Opensource Backer

- Posts: 7393
- Joined: Sat Apr 08, 2006 8:31 pm
-
Contact:
Post
by jacque » Wed Jul 06, 2016 5:18 pm
Try something like this:
Code: Select all
get "https://ssl15.ovh.net/~myDomain/myPage.html"
replace "~" with "%7e" in it
put it into tDomain
I couldn't test that because I don't have an example of a domain with a tilde, but that's the url encoding for it.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
-
Zax
- Posts: 519
- Joined: Mon May 28, 2007 10:12 am
-
Contact:
Post
by Zax » Thu Jul 07, 2016 8:41 am
jacque wrote:Try something like this:
Code: Select all
get "https://ssl15.ovh.net/~myDomain/myPage.html"
replace "~" with "%7e" in it
put it into tDomain
Thank you Jacqueline, but it's always the same. I really don't understand where is the problem.
I also try with
before launch URL without any success.
-
[-hh]
- VIP Livecode Opensource Backer

- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
Post
by [-hh] » Thu Jul 07, 2016 9:41 am
You may try:
launch url ("
https://ssl15.ovh.net/"&numToChar(126)& ... yPage.html")
The problem could be that the tilde on your keyboard is generated not directly but for example by "option-n space". Some browsers (Firefox) correct this.
[The incorrect interpretation of your first post (E8B3) is an UTF-16 question mark, used for 'unknown chars'. So possibly your "tilde" is interpreted as UTF-16/two bytes.]
shiftLock happens
-
Zax
- Posts: 519
- Joined: Mon May 28, 2007 10:12 am
-
Contact:
Post
by Zax » Thu Jul 07, 2016 11:49 am
[-hh] wrote:You may try:
launch url ("
https://ssl15.ovh.net/"&numToChar(126)& ... yPage.html")
The problem could be that the tilde on your keyboard is generated not directly but for example by "option-n space". Some browsers (Firefox) correct this.
[The incorrect interpretation of your first post (E8B3) is an UTF-16 question mark, used for 'unknown chars'. So possibly your "tilde" is interpreted as UTF-16/two bytes.]
The URL that appears in Firefox is now:
https://ssl15.ovh.net/LE8B3myDomain/myPage.html
I also tried numToCodepoint(0x7e) with the same result.
-
MaxV
- Posts: 1580
- Joined: Tue May 28, 2013 2:20 pm
-
Contact:
Post
by MaxV » Thu Jul 07, 2016 12:06 pm
What happen with this code
Code: Select all
put quote & "https://ssl15.ovh.net/~myDomain/myPage.html" & quote into myURL
put shell("/Applications/Firefox.app/Contents/MacOS/firefox " & myUrl)
??
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
-
Zax
- Posts: 519
- Joined: Mon May 28, 2007 10:12 am
-
Contact:
Post
by Zax » Thu Jul 07, 2016 1:18 pm
MaxV wrote:What happen with this code
Code: Select all
put quote & "https://ssl15.ovh.net/~myDomain/myPage.html" & quote into myURL
put shell("/Applications/Firefox.app/Contents/MacOS/firefox " & myUrl)
??
If Firefox is already launched, Message Box contains:
Message box wrote:2016-07-07 14:13:28.977 firefox[585:903] *** __NSAutoreleaseNoPool(): Object 0x1003cb500 of class NSCFDictionary autoreleased with no pool in place - just leaking
2016-07-07 14:13:28.980 firefox[585:903] *** __NSAutoreleaseNoPool(): Object 0x1003c14f0 of class NSCFArray autoreleased with no pool in place - just leaking
2016-07-07 14:13:34.248 firefox[585:903] *** __NSAutoreleaseNoPool(): Object 0x1003b8aa0 of class NSCFString autoreleased with no pool in place - just leaking
2016-07-07 14:13:34.645 firefox[585:903] Error loading /Library/ScriptingAdditions/QXPScriptingAdditions.osax/Contents/MacOS/QXPScriptingAdditions: dlopen(/Library/ScriptingAdditions/QXPScriptingAdditions.osax/Contents/MacOS/QXPScriptingAdditions, 262): no suitable image found. Did find:
/Library/ScriptingAdditions/QXPScriptingAdditions.osax/Contents/MacOS/QXPScriptingAdditions: no matching architecture in universal wrapper
firefox: OpenScripting.framework - scripting addition "/Library/ScriptingAdditions/QXPScriptingAdditions.osax" declares no loadable handlers.
I not, it works but it freezes LC.
-
[-hh]
- VIP Livecode Opensource Backer

- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
Post
by [-hh] » Thu Jul 07, 2016 3:06 pm
[Please tell us the versions you use: MacOS, Firefox, and LiveCode.]
This works (and also other 'usual solutions' above work)
with MacOS 10.9 to 10.12 in Safari, Firefox and Chrome and LC 6/7/8.
I tested all with LC-scripts and a real "tilde-URL".
Code: Select all
tell application "Safari" -- or "Firefox" or "Google Chrome"
open location "http://ssl15.ovh.net/%7EmyDomain/myPage.html"
-- open location "http://ssl15.ovh.net/~myDomain/myPage.html" -- works also
end tell
You could try it from the Applescript Editor to see if your LC version is the culprit. If not then you could try the different browsers if there are differences.
shiftLock happens
-
FourthWorld
- VIP Livecode Opensource Backer

- Posts: 10052
- Joined: Sat Apr 08, 2006 7:05 am
-
Contact:
Post
by FourthWorld » Thu Jul 07, 2016 3:51 pm
Here's some background on the use of tildes in URLs:
https://www.cs.tut.fi/~jkorpela/tilde.html
It would seem the initial translation of the tilde to anything other than its character entity equivalent is incorrect. That may be a bug in LC, or the CEF browser, or elsewhere. Are you using the most recent build of LC?
To get this working for now, Jacque's suggestion of replacing the tilde with its character entity form seems the simplest, and the most consistent with the recommendations of the relevant RFCs as noted in the article above.
-
[-hh]
- VIP Livecode Opensource Backer

- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
Post
by [-hh] » Thu Jul 07, 2016 4:28 pm
One could also use the *actual* RFC 3986 (2005)
http://www.rfc-editor.org/rfc/rfc3986.txt
There you'll find even the recommendation to replace -- vice versa -- occurrences of "%7E" with "~" in an URI:
RFC 3986 wrote:For consistency, percent-encoded octets in the ranges of
ALPHA (%41-%5A and %61-%7A), DIGIT (%30-%39), hyphen (%2D), period (%2E), underscore (%5F), or tilde (%7E)
should not be created by URI producers and, when found in a URI, should be decoded to their corresponding unreserved characters by URI normalizers.
shiftLock happens