Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
Encoding/Decoding - Hex, Base64, URL, Quoted-Printable w/ any Charset
Demonstrates how to encode/decode strings in various encodings w/ any charset. <% @CodePage = 1252 %> <% Response.CodePage = 1252 %> <html> <head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"></head> <body> <% set cks = Server.CreateObject("Chilkat_9_5_0.CkString") ' Demonstrate how to encode/decode strings. s = "eèéêë" cks.Append s Response.Write "<p>" Response.Write cks.Str Response.Write "<br>" Response.Write "hex, windows-1252: " & cks.GetEncoded("hex","windows-1252") Response.Write "<br>" Response.Write "hex, utf-8: " & cks.GetEncoded("hex","utf-8") Response.Write "<br>" Response.Write "url-encoded, windows-1252: " & cks.GetEncoded("url","windows-1252") Response.Write "<br>" Response.Write "url-encoded, utf-8: " & cks.GetEncoded("url","utf-8") Response.Write "<br>" Response.Write "base64, windows-1252: " & cks.GetEncoded("base64","windows-1252") Response.Write "<br>" Response.Write "base64, utf-8: " & cks.GetEncoded("base64","utf-8") Response.Write "<br>" Response.Write "quoted-printable, windows-1252: " & cks.GetEncoded("quoted-printable","windows-1252") Response.Write "<br>" Response.Write "quoted-printable, utf-8: " & cks.GetEncoded("quoted-printable","utf-8") Response.Write "</p>" ' Prints this: ' hex, windows-1252: 65E8E9EAEB ' hex, utf-8: 65C3A8C3A9C3AAC3AB ' url-encoded, windows-1252: e%E8%E9%EA%EB ' url-encoded, utf-8: e%C3%A8%C3%A9%C3%AA%C3%AB ' base64, windows-1252: Zejp6us= ' base64, utf-8: ZcOow6nDqsOr ' quoted-printable, windows-1252: e=E8=E9=EA=EB ' quoted-printable, utf-8: e=C3=A8=C3=A9=C3=AA=C3=AB ' Demonstrate decoding by appending the encoded form and outputting ' the string. ' All of the following Response.Write lines print "eèéêë" cks.Clear cks.AppendEncoded "65E8E9EAEB","hex","windows-1252" Response.Write cks.Str & "<br>" cks.Clear cks.AppendEncoded "65C3A8C3A9C3AAC3AB","hex","utf-8" Response.Write cks.Str & "<br>" cks.Clear cks.AppendEncoded "e%E8%E9%EA%EB","url","windows-1252" Response.Write cks.Str & "<br>" cks.Clear cks.AppendEncoded "e%C3%A8%C3%A9%C3%AA%C3%AB","url","utf-8" Response.Write cks.Str & "<br>" cks.Clear cks.AppendEncoded "Zejp6us=","base64","windows-1252" Response.Write cks.Str & "<br>" cks.Clear cks.AppendEncoded "ZcOow6nDqsOr","base64","utf-8" Response.Write cks.Str & "<br>" cks.Clear cks.AppendEncoded "e=E8=E9=EA=EB","quoted-printable","windows-1252" Response.Write cks.Str & "<br>" cks.Clear cks.AppendEncoded "e=C3=A8=C3=A9=C3=AA=C3=AB","quoted-printable","utf-8" Response.Write cks.Str & "<br>" %> </body> </html> |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.