Java Requires Chilkat v11.1.0+
Chilkat2 Java
HTML Entity Encode and Decode in StringBuilder
Demonstrates HTML encoding and decoding the contents of a StringBuilder.Chilkat Java Downloads
import com.chilkatsoft.chilkat2.StringBuilder;
public class ChilkatExample {
public static void main(String[] args) {
StringBuilder sb = new StringBuilder();
String s = "< é ü ç Ω Hello & World ✓ >";
sb.append(s);
sb.encode("html", "utf-8");
System.out.println(sb.getAsString());
// Output:
// < é ü ç Ω Hello & World ✓ >
// To decode:
sb.decode("html", "utf-8");
System.out.println(sb.getAsString());
// Output:
// < é ü ç Ω Hello & World ✓ >
}
}