I have a URL encoded to place in a db and then want to decode it to use on
page.

Rob Swiger
Webmaster
TCRHonline - Where People Care

Twin County Regional Healthcare
200 Hospital Drive
Galax, Virginia  24333
(276) 238-3515 PHONE
(276) 236-2660 FAX
http://www.tcrh.org
[EMAIL PROTECTED]

GO HOKIES!!! 

-----Original Message-----
From: David L. Penton [mailto:david@;davidpenton.com] 
Sent: Wednesday, October 30, 2002 12:03 PM
To: ActiveServerPages
Subject: RE: URLDecode

Yes it does.  Recently documented as MSDN:  escape ann unescape.  Check it
out.

Not sure why you need it.  The URL is decoded when you read it from the
Request.QueryString collection

David L. Penton, Microsoft MVP
JCPenney Application Specialist / Lead
"Mathematics is music for the mind, and Music is Mathematics for the
Soul. - J.S. Bach"
[EMAIL PROTECTED]

Do you have the VBScript Docs or SQL BOL installed?  If not, why not?
VBScript Docs: http://www.davidpenton.com/vbscript
SQL BOL: http://www.davidpenton.com/sqlbol


-----Original Message-----
From: Oladapo Oguntoyinbo [mailto:doguntoy@;ItechTraining.com]

A Urldecode function does not exist to the best of my knowledge.
Here is a customized function to do what I think you want to do...

*****************************************************************
Function URLDecode(ByVal What)
'URL decode Function
'2001 Antonin Foller, PSTRUH Software, http://www.pstruh.cz
  Dim Pos, pPos

  'replace + To Space
  What = Replace(What, "+", " ")

  on error resume Next
  Dim Stream: Set Stream = CreateObject("ADODB.Stream")
  If err = 0 Then 'URLDecode using ADODB.Stream, If possible
    on error goto 0
    Stream.Type = 2 'String
    Stream.Open

    'replace all %XX To character
    Pos = InStr(1, What, "%")
    pPos = 1
    Do While Pos > 0
      Stream.WriteText Mid(What, pPos, Pos - pPos) + _
        Chr(CLng("&H" & Mid(What, Pos + 1, 2)))
      pPos = Pos + 3
      Pos = InStr(pPos, What, "%")
    Loop
    Stream.WriteText Mid(What, pPos)

    'Read the text stream
    Stream.Position = 0
    URLDecode = Stream.ReadText

    'Free resources
    Stream.Close
  Else 'URL decode using string concentation
    on error goto 0
    'UfUf, this is a little slow method.
    'Do Not use it For data length over 100k
    Pos = InStr(1, What, "%")
    Do While Pos>0
      What = Left(What, Pos-1) + _
        Chr(Clng("&H" & Mid(What, Pos+1, 2))) + _
        Mid(What, Pos+3)
      Pos = InStr(Pos+1, What, "%")
    Loop
    URLDecode = What
  End If
End Function

*******************************************************************

-----Original Message-----
From: Robert Swiger [mailto:rswiger@;tcrh.org]

How do I use URLDecode? Each time I used it, after using URLEncode, I get an
error:

Microsoft VBScript runtime error '800a000d'

Type mismatch: 'urldecode'

functions.inc, line 161

I have tried using server.urldecode(string), string.urldecode(string) and
urldecode(string) and get an error each time.

Please help.

Rob Swiger
Webmaster
TCRHonline - Where People Care

Twin County Regional Healthcare
200 Hospital Drive
Galax, Virginia  24333
(276) 238-3515 PHONE
(276) 236-2660 FAX
http://www.tcrh.org
[EMAIL PROTECTED]

GO HOKIES!!!


---
You are currently subscribed to activeserverpages as: [EMAIL PROTECTED]
To unsubscribe send a blank email to
%%email.unsub%%
Confidentiality Notice:  This email message, including any attachments, is
for the sole use of the intended recipient(s) and may contain confidential
and privileged information.  Any unauthorized review, use, disclosure or
distribution is prohibited.  If you are not the intended recipient, please
contact the sender by reply email and destroy all copies of the original
message.

---
You are currently subscribed to activeserverpages as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]

Reply via email to