Sample code for 30+ languages & platforms
PowerBuilder

URL Encoding and Decoding

Demonstrates URL encoding/decoding using the HTTP convenience methods.

Chilkat PowerBuilder Downloads

PowerBuilder
integer li_rc
oleobject loo_Http
string s
string ls_Encoded
string ls_Decoded

loo_Http = create oleobject
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
    destroy loo_Http
    MessageBox("Error","Connecting to COM object failed")
    return
end if

s = "Hello World! 100% sure."

ls_Encoded = loo_Http.UrlEncode(s)
Write-Debug "URL encoded: " + ls_Encoded

// Space → %20
// ! → %21
// % → %25

ls_Decoded = loo_Http.UrlDecode(ls_Encoded)
Write-Debug "URL decoded: " + ls_Decoded

// Output:

// URL encoded: Hello%20World%21%20100%25%20sure.
// URL decoded: Hello World! 100% sure.


destroy loo_Http