Sample code for 30+ languages & platforms
Perl Requires Chilkat v11.1.0+

HTML Encoding

Demonstrates HTML encoding and decoding.

Chilkat Perl Downloads

Chilkat2 Perl
use strict;
use warnings;
use Chilkat2;

my $crypt = Chilkat2::Crypt2->new;

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

my $htmlEncoded = $crypt->EncodeString($s, 'utf-8', 'html');
print $htmlEncoded, "\n";

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

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

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