Classic ASP
Classic ASP
HTML Entity Encode and Decode in StringBuilder
Demonstrates HTML encoding and decoding the contents of a StringBuilder.Chilkat Classic ASP Downloads
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
set sb = Server.CreateObject("Chilkat.StringBuilder")
s = "< é ü ç Ω Hello & World ✓ >"
success = sb.Append(s)
success = sb.Encode("html","utf-8")
Response.Write "<pre>" & Server.HTMLEncode( sb.GetAsString()) & "</pre>"
' Output:
' < é ü ç Ω Hello & World ✓ >
' To decode:
success = sb.Decode("html","utf-8")
Response.Write "<pre>" & Server.HTMLEncode( sb.GetAsString()) & "</pre>"
' Output:
' < é ü ç Ω Hello & World ✓ >
%>
</body>
</html>