Sample code for 30+ languages & platforms
VBScript

HTML Entity Encode and Decode in StringBuilder

Demonstrates HTML encoding and decoding the contents of a StringBuilder.

Chilkat VBScript Downloads

VBScript
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)

set sb = CreateObject("Chilkat.StringBuilder")

s = "< é ü ç Ω Hello & World ✓ >"
success = sb.Append(s)

success = sb.Encode("html","utf-8")
outFile.WriteLine(sb.GetAsString())

' Output:
' < &eacute; &uuml; &ccedil; &ohm; Hello & World &check; >

' To decode:
success = sb.Decode("html","utf-8")
outFile.WriteLine(sb.GetAsString())

' Output:
' < é ü ç Ω Hello & World ✓ >

outFile.Close