Unicode C
Unicode C
HTML Entity Encode and Decode in StringBuilder
Demonstrates HTML encoding and decoding the contents of a StringBuilder.Chilkat Unicode C Downloads
#include <C_CkStringBuilderW.h>
void ChilkatSample(void)
{
HCkStringBuilderW sb;
const wchar_t *s;
sb = CkStringBuilderW_Create();
s = L"< é ü ç Ω Hello & World ✓ >";
CkStringBuilderW_Append(sb,s);
CkStringBuilderW_Encode(sb,L"html",L"utf-8");
wprintf(L"%s\n",CkStringBuilderW_getAsString(sb));
// Output:
// < é ü ç Ω Hello & World ✓ >
// To decode:
CkStringBuilderW_Decode(sb,L"html",L"utf-8");
wprintf(L"%s\n",CkStringBuilderW_getAsString(sb));
// Output:
// < é ü ç Ω Hello & World ✓ >
CkStringBuilderW_Dispose(sb);
}