Solved

VbScript equivalent to escape function

Posted on 1998-07-07
8
366 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

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
 
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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…

810 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