This conversion should include " " to %20 etc. replaces.
Solution
set myStr to «class ktxt» of ((myStr as string) as record)
doesn’t work
Any idea? Maybe there some kind of quick replacement instead of manual search/replace routines
This conversion should include " " to %20 etc. replaces.
Solution
set myStr to «class ktxt» of ((myStr as string) as record)
doesn’t work
Any idea? Maybe there some kind of quick replacement instead of manual search/replace routines
Hi,
the easiest solution is using a perl function
set theURL to "viewtopic.php ?id=26733"
set escapedText to do shell script "perl -e 'use URI::Escape; print uri_escape(\"" & theURL & "\")';"
--> "viewtopic.php%20%3Fid%3D26733"
PS: There’s also a fully AppleScript solution by Apple
For Ruby’s sake
set theURL to "viewtopic.php ?id=26733"
set escapedText to do shell script "/usr/bin/ruby -e 'require \"uri\";puts URI.escape(\"" & theURL & "\")'"
For Python’s sake
set theURL to "viewtopic.php ?id=26733"
do shell script "/usr/bin/python -c \"import urllib\nprint urllib.quote('" & theURL & "')\""
For PHP’s sake
set theURL to "viewtopic.php ?id=26733"
set escapedText to do shell script "php -r 'echo urlencode(\"" & theURL & "\");'"