(Classic ASP) Base62 Encoding and Decoding
Demonstrates base62 encoding and decoding. Note: This example requires Chilkat v11.2.0 or greater.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
set bd = Server.CreateObject("Chilkat.BinData")
' Base62 encode.
success = bd.AppendString("hello world","utf-8")
base62_encoded = bd.GetEncoded("base62")
Response.Write "<pre>" & Server.HTMLEncode( "hello world --> " & base62_encoded) & "</pre>"
' Output:
' hello world --> AAwf93rvy4aWQVw
' Base62 decode
set sb = Server.CreateObject("Chilkat.StringBuilder")
success = sb.DecodeAndAppend("AAwf93rvy4aWQVw","base62","utf-8")
Response.Write "<pre>" & Server.HTMLEncode( "decoded: " & sb.GetAsString()) & "</pre>"
' Output:
' decoded: hello world
%>
</body>
</html>
|