Sample code for 30+ languages & platforms
DataFlex

HTML Entity Encode and Decode in StringBuilder

Demonstrates HTML encoding and decoding the contents of a StringBuilder.

Chilkat DataFlex Downloads

DataFlex
Use ChilkatAx-win32.pkg

Procedure Test
    Handle hoSb
    String s
    Boolean iSuccess
    String sTemp1

    Get Create (RefClass(cComChilkatStringBuilder)) To hoSb
    If (Not(IsComObjectCreated(hoSb))) Begin
        Send CreateComObject of hoSb
    End

    Move "< é ü ç Ω Hello & World ✓ >" To s
    Get ComAppend Of hoSb s To iSuccess

    Get ComEncode Of hoSb "html" "utf-8" To iSuccess
    Get ComGetAsString Of hoSb To sTemp1
    Showln sTemp1

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

    // To decode:
    Get ComDecode Of hoSb "html" "utf-8" To iSuccess
    Get ComGetAsString Of hoSb To sTemp1
    Showln sTemp1

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


End_Procedure