Url Encode String
tell application "BBEdit"
set theData to contents of text window 1
set theNewContents to my urlEncode(theData)
set contents of text window 1 to theNewContents
end tell
on urlUnEncode(theString)
local theResult, theCharacters, theReplacements, tempString
set theResult to ""
set tempString to ""
set theReplacements to {" ", "&", "\"", "'", tab, return, "(", ")", "@"}
set theCharacters to {"%20", "%26", "%22", "%27", "%09", "%0d", "%28", "%29", "%40"}
repeat with i from 1 to count of theCharacters
set tempString to my breakStringAtCharacter(theString, item i of theCharacters)
set AppleScript's text item delimiters to (item i of theReplacements)
set theString to every item of tempString as string
end repeat
set theResult to theString
return theResult
end urlUnEncode
Open this Script in Script Editor by clicking
here. This link only works with OS 10.3 or
later.