(* A reader named Eric was inspired to send in the following url decoder. It seems to work, at least with ascii characters up to 127 (which is probably sufficient for many applications). For some higher number characters (like characters with umlauts, symbols etc) you may run into character encoding problems since the mac uses the mac roman character set, and most servers on the net use something like the windows latin set for encoding. (e.g. ü might decode as ¸) see: convert macroman to windows-1252 encoding *)

set theSampleURL to "http://harvey.nu/applescript_url_decode_routine.html?query=math%3A+one+%2B+two+%3D+three"
set theText to text returned of (display dialog "decode what" default answer theSampleURL)
set theTextDec to urldecode(theText) of me
display dialog theTextDec default answer theTextDec



on urldecode(theText)
	set sDst to ""
	set sHex to "0123456789ABCDEF"
	set i to 1
	repeat while i ≤ length of theText
		set c to character i of theText
		if c = "+" then
			set sDst to sDst & " "
		else if c = "%" then
			if i > ((length of theText) - 2) then
				display dialog ("Invalid URL Encoded string - missing hex char") buttons {"Crap..."} with icon stop
				return ""
			end if
			set iCVal1 to (offset of (character (i + 1) of theText) in sHex) - 1
			set iCVal2 to (offset of (character (i + 2) of theText) in sHex) - 1
			if iCVal1 = -1 or iCVal2 = -1 then
				display dialog ("Invalid URL Encoded string - not 2 hex chars after % sign") buttons {"Crap..."} with icon stop
				return ""
			end if
			set sDst to sDst & (ASCII character (iCVal1 * 16 + iCVal2))
			set i to i + 2
		else
			set sDst to sDst & c
		end if
		set i to i + 1
	end repeat
	return sDst
end urldecode

--thanks eric

-- applescript url encoding page
-- applescript page