Java
Java
HTML Encoding
Demonstrates HTML encoding and decoding.Chilkat Java Downloads
import com.chilkatsoft.*;
public class ChilkatExample {
static {
try {
System.loadLibrary("chilkat");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load.\n" + e);
System.exit(1);
}
}
public static void main(String argv[])
{
CkCrypt2 crypt = new CkCrypt2();
String s = "< é ü ç Ω Hello & World ✓ >";
String htmlEncoded = crypt.encodeString(s,"utf-8","html");
System.out.println(htmlEncoded);
// Output:
// < é ü ç Ω Hello & World ✓ >
// To decode:
s = crypt.decodeString(htmlEncoded,"utf-8","html");
System.out.println(s);
// Output:
// < é ü ç Ω Hello & World ✓ >
}
}