(DataFlex) HTML Entity Encode and Decode in StringBuilder
Demonstrates HTML encoding and decoding the contents of a StringBuilder. Note: This example requires Chilkat v11.1.0 or greater.
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:
// < é ü ç Ω Hello & World ✓ >
// To decode:
Get ComDecode Of hoSb "html" "utf-8" To iSuccess
Get ComGetAsString Of hoSb To sTemp1
Showln sTemp1
// Output:
// < é ü ç Ω Hello & World ✓ >
End_Procedure
|