Solved

VbScript equivalent to escape function

Posted on 1998-07-07
8
361 Views
Last Modified: 2008-02-01
hi,

Is there a VB-Script equivalent to the JS unescape function?
thanks,
ralph
0
Comment
Question by:rakhras
  • 4
  • 3
8 Comments
 

Author Comment

by:rakhras
ID: 1266304
Edited text of question
0
 
LVL 6

Expert Comment

by:alamo
ID: 1266305
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
 
LVL 28

Expert Comment

by:sybe
ID: 1266306
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
 

Author Comment

by:rakhras
ID: 1266307
sybe,

I actually need the function for server side decoding.
Any chance of getting your URLDecode for some points?
ralph.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 28

Expert Comment

by:sybe
ID: 1266308
yep, 100 points and i'll give it to you
0
 

Author Comment

by:rakhras
ID: 1266309
sybe,

I increased the points to 100.

ralph
0
 
LVL 28

Accepted Solution

by:
sybe earned 100 total points
ID: 1266310
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
 

Author Comment

by:rakhras
ID: 1266311
great. thanks.
ralph.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now