VbScript equivalent to escape function

hi,

Is there a VB-Script equivalent to the JS unescape function?
thanks,
ralph
rakhrasAsked:
Who is Participating?
 
sybeConnect With a Mentor Commented:
OK, here it is

Function URLDecode(str)
  strInput = str
  If strInput = null Then strInput = ""
  'First replace "+" with " " (javascript unescape does not do this)
  strOutput = REPLACE(strInput, "+", " ")
  'Then decode the "%number"
  strSplit = Split(strOutput, "%")
  If ubound(strSplit) > 0 Then
    i = 0
    strOutput = strSplit(i)
    Do While i < ubound(strSplit)
      HexCode =  "&H" & Left(strSplit(i+1),2)
      Letter = CHR(HexCode)
      strOutput = strOutput & Letter & Right(strSplit(i+1),len(strSplit(i+1))-2)
      i = i + 1
    Loop
  End If
  URLDecode = strOutput
End Function


0
 
rakhrasAuthor Commented:
Edited text of question
0
 
alamoCommented:
Not for client-side VBScript.

You need to either write your own function, find someone who's done it, or define a javascript function which does the encode and call it from your VBScript.
0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

 
sybeCommented:
in ASP it's Server.URLEncode(), but that is server side script.
I have written a URLDecode() which does reverses the urlencode. Encoding seems a bit harder though.


0
 
rakhrasAuthor Commented:
sybe,

I actually need the function for server side decoding.
Any chance of getting your URLDecode for some points?
ralph.
0
 
sybeCommented:
yep, 100 points and i'll give it to you
0
 
rakhrasAuthor Commented:
sybe,

I increased the points to 100.

ralph
0
 
rakhrasAuthor Commented:
great. thanks.
ralph.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.