Sample code for 30+ languages & platforms
PowerBuilder

HTML Entity Encode and Decode in StringBuilder

Demonstrates HTML encoding and decoding the contents of a StringBuilder.

Chilkat PowerBuilder Downloads

PowerBuilder
integer li_rc
oleobject loo_Sb
string s

loo_Sb = create oleobject
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

s = "< é ü ç Ω Hello & World ✓ >"
loo_Sb.Append(s)

loo_Sb.Encode("html","utf-8")
Write-Debug loo_Sb.GetAsString()

// Output:
// < &eacute; &uuml; &ccedil; &ohm; Hello & World &check; >

// To decode:
loo_Sb.Decode("html","utf-8")
Write-Debug loo_Sb.GetAsString()

// Output:
// < é ü ç Ω Hello & World ✓ >


destroy loo_Sb