Escape

Encode a string of text, "escaping" all spaces, punctuation, accented characters, and other non-ASCII characters.
Characters are replaced with %xx encoding, where xx is equivalent to the hexadecimal number representing the character. Unicode characters that have a value greater than 255 are stored using the %uxxxx format.”

Syntax 
      Escape(String)

Key
   String    The string of text to convert to an encoded string for use with HTML data transfer.

Some web browsers will display URLs even without properly escaped characters. HTML with unescaped punctuation will fail validation.

Examples

Option Explicit

Dim strMessage
strMessage = "Sample text with (parentheses) spaces & " & Chr(34) & "quotes" & Chr(34)

MsgBox strMessage& vbCR & Escape(strMessage), vbOkOnly+vbInformation, "Demo"

PowerShell equivalent, load the .NET Framework System.Web class and then use the Web.HTTPUtility class URLEncode method:

[Reflection.Assembly]::LoadWithPartialName("System.Web")
$result = [web.httputility]::urlencode("http://windevcluster.com/vb/escape.html")

The value of $result should then contain:

http%3a%2f%2fwindevcluster.com%2fvb%2fescape.html

“Writing is a form of therapy; sometimes I wonder how all those, who do not write, compose, or paint can manage to escape the madness, the melancholia, the panic fear, which is inherent in a human condition” ~ Graham Greene

Related VBScript commands

UnEscape - Return Unicode characters from an escaped ASCII string.


 
Copyright © 1999-2025 windevcluster.com
Some rights reserved