Rust Requires Chilkat v11.1.0+
Rust
HTML Entity Encode and Decode in StringBuilder
Demonstrates HTML encoding and decoding the contents of a StringBuilder.Chilkat Rust Downloads
let sb = chilkat::StringBuilder::new();
let s = "< é ü ç Ω Hello & World ✓ >".to_string();
let _ = sb.append(&s);
let _ = sb.encode("html", "utf-8");
println!("{}", sb.get_as_string().unwrap_or_default());
// Output:
// < é ü ç Ω Hello & World ✓ >
// To decode:
let _ = sb.decode("html", "utf-8");
println!("{}", sb.get_as_string().unwrap_or_default());
// Output:
// < é ü ç Ω Hello & World ✓ >