![]() |
Chilkat HOME Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi DLL Go Java Node.js Objective-C PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(PowerBuilder) URL Encoding and DecodingDemonstrates URL encoding and decoding.
integer li_rc string s oleobject loo_Sb integer li_Success string ls_SEncoded integer li_NumReplaced // To URL encoding a string: s = "Why a > b?" loo_Sb = create oleobject // Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0 li_rc = loo_Sb.ConnectToNewObject("Chilkat.StringBuilder") if li_rc < 0 then destroy loo_Sb MessageBox("Error","Connecting to COM object failed") return end if li_Success = loo_Sb.Append(s) // URL encode the string. loo_Sb.Encode("url","utf-8") // Show the URL encoded string: ls_SEncoded = loo_Sb.GetAsString() Write-Debug ls_SEncoded // The result is: Why%20a%20%3E%20b%3F // If you prefer "+" instead of "%20" for SPACE chars: li_NumReplaced = loo_Sb.Replace("%20","+") Write-Debug loo_Sb.GetAsString() // Output is: Why+a+%3E+b%3F // To decode: loo_Sb.Decode("url","utf-8") Write-Debug loo_Sb.GetAsString() // Result is: Why a > b? destroy loo_Sb |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.