Solved

VbScript equivalent to escape function

Posted on 1998-07-07
8
387 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 

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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

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…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…

696 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