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
(DataFlex) URL Encoding and DecodingDemonstrates URL encoding and decoding.
Use ChilkatAx-9.5.0-win32.pkg Procedure Test String s Handle hoSb Boolean iSuccess String sSEncoded Integer iNumReplaced String sTemp1 // To URL encoding a string: Move "Why a > b?" To s Get Create (RefClass(cComChilkatStringBuilder)) To hoSb If (Not(IsComObjectCreated(hoSb))) Begin Send CreateComObject of hoSb End Get ComAppend Of hoSb s To iSuccess // URL encode the string. Get ComEncode Of hoSb "url" "utf-8" To iSuccess // Show the URL encoded string: Get ComGetAsString Of hoSb To sSEncoded Showln sSEncoded // The result is: Why%20a%20%3E%20b%3F // If you prefer "+" instead of "%20" for SPACE chars: Get ComReplace Of hoSb "%20" "+" To iNumReplaced Get ComGetAsString Of hoSb To sTemp1 Showln sTemp1 // Output is: Why+a+%3E+b%3F // To decode: Get ComDecode Of hoSb "url" "utf-8" To iSuccess Get ComGetAsString Of hoSb To sTemp1 Showln sTemp1 // Result is: Why a > b? End_Procedure |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.