Sample code for 30+ languages & platforms
Perl

HTML Encoding

Demonstrates HTML encoding and decoding.

Chilkat Perl Downloads

Perl
use chilkat();

$crypt = chilkat::CkCrypt2->new();

$s = "< é ü ç Ω Hello & World ✓ >";

$htmlEncoded = $crypt->encodeString($s,"utf-8","html");
print $htmlEncoded . "\r\n";

# Output:
# < &eacute; &uuml; &ccedil; &ohm; Hello & World &check; >

# To decode:
$s = $crypt->decodeString($htmlEncoded,"utf-8","html");
print $s . "\r\n";

# Output:
# < é ü ç Ω Hello & World ✓ >