Re: encode url without OSAX
Re: encode url without OSAX
- Subject: Re: encode url without OSAX
- From: Paul Berkowitz <email@hidden>
- Date: Fri, 29 Jun 2001 20:44:04 -0700
On 6/29/01 8:12 PM, "Brian" <email@hidden> wrote:
>
trying to script an http upload script I ran into a need to encode
>
characters for use in a url and I quickly located the "Encode URL" OSAX,
but
>
wanted to try to avoid scripting additions if at all possible.
>
>
I thought I might be able to do something like:
>
>
set x to "the quick brown fox"
>
set y to every text item of x
>
repeat with i in y
>
if i = " " then
>
set i to " "
>
end if
>
end repeat
>
return y as string
>
>
but the result still shows the <spaces> as <spaces> rather than s.
>
>
Any ideas what I'm missing/doing wrong/don't understand?
>
You're merely re-setting 'i', a variable, each time it's equal to " ".
You're not changing anything in the the list y. You want to do this :
set AppleScript's text item delimiters to {""} -- make sure
set x to "the quick brown fox"
set y to every character of x
repeat with i from 1 to (count y)
if item i of y = " " then
set item i of y to " "
end if
end repeat
return y as text
--
Paul Berkowitz