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
(PowerBuilder) HTTP GET with utf-8 URL Encoded Query ParamsDemonstrates how to build URLs where query param values can be either URL encoded from the utf-8 representation, or from another charset such as windows-1252. Note: This example uses the new DecodeAndAppend method added in Chilkat v9.5.0.87.
integer li_rc string ls_NameWindows1252UrlEncoded oleobject loo_Sb1 integer li_Success oleobject loo_Http oleobject loo_SbUrl string ls_ResponseBody // We have the string "MÆRSK". // This is the URL encoding of the windows-1252 representation. ls_NameWindows1252UrlEncoded = "M%C6RSK" loo_Sb1 = create oleobject // Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0 li_rc = loo_Sb1.ConnectToNewObject("Chilkat.StringBuilder") if li_rc < 0 then destroy loo_Sb1 MessageBox("Error","Connecting to COM object failed") return end if li_Success = loo_Sb1.DecodeAndAppend(ls_NameWindows1252UrlEncoded,"url","windows-1252") loo_Http = create oleobject // Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0 li_rc = loo_Http.ConnectToNewObject("Chilkat.Http") // Here's how to send an HTTP GET where the param is the utf-8 representation that is URL encoded. // For example: https://www.chilkatsoft.com/something?name=M%C3%A6RSK loo_SbUrl = create oleobject // Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0 li_rc = loo_SbUrl.ConnectToNewObject("Chilkat.StringBuilder") loo_SbUrl.Append("https://www.chilkatsoft.com/something?name=") loo_SbUrl.Append(loo_Sb1.GetEncoded("url","utf-8")) Write-Debug loo_SbUrl.GetAsString() ls_ResponseBody = loo_Http.QuickGetStr(loo_SbUrl.GetAsString()) // Here's how to send an HTTP GET where the param is the windows-1252 representation that is URL encoded. // For example: https://www.chilkatsoft.com/something?name=M%E6RSK loo_SbUrl.Clear() loo_SbUrl.Append("https://www.chilkatsoft.com/something?name=") loo_SbUrl.Append(loo_Sb1.GetEncoded("url","windows-1252")) Write-Debug loo_SbUrl.GetAsString() ls_ResponseBody = loo_Http.QuickGetStr(loo_SbUrl.GetAsString()) destroy loo_Sb1 destroy loo_Http destroy loo_SbUrl |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.