?
Solved

VbScript equivalent to escape function

Posted on 1998-07-07
8
Medium Priority
?
394 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
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 

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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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 discusses how to implement server side field validation and display customized error messages to the client.
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…
Suggested Courses

777 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