Perl Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript



Perl Examples

Quick Start
Perl Unicode
Perl Byte Array
Perl Certs
Perl Email
Perl Encryption
Perl FTP
HTML-to-XML
Perl HTTP
Perl IMAP
Perl MHT
Perl MIME
Perl RSA
Perl S/MIME
Perl Signatures
Perl Socket
Perl Spider
Perl Tar
Perl Upload
Perl XML
Perl XMP
Perl Zip

More Examples...
String
Email Object
POP3
SMTP
RSS
Atom
Self-Extractor

Unreleased...
Service
PPMD
Deflate
Bzip2
LZW
Bz2
DH Key Exchange
DSA
Icon

 

 

 

 

 

 

 

HTML Entity Encode and Decode

Perl script to HTML entity encode and decode strings.

Download Perl Programming Example Scripts

#The declaration "use utf8;" determines how the script source file containing it is 
#interpreted. If this declaration is used, strings within the source file will be 
#interpreted as being encoded in utf8.
use utf8;

use chilkat;

$s = new chilkat::CkString();
$s->appendUtf8("Is féidir liom gloinne a ithe. Ní dhéanann sí dochar ar bith dom.");
$s->entityEncode();

# Note: Printing to the DOS console requires the OEM code page,
# which is ibm850 on US and Western European computers...

# Prints: "Is féidir liom gloinne a ithe. Ní dhéanann sí dochar ar bith dom."

print($s->getEnc("ibm850") . "\n");

# Now decode the entities...
$s->entityDecode();

# Prints: "Is féidir liom gloinne a ithe. Ní dhéanann sí dochar ar bith dom."
print($s->getEnc("ibm850") . "\n");

# PS: Here are ways to get the string into a PERL string variable
# in the encoding of your choice...
$s1 = $s->getUtf8();
$s2 = $s->getAnsi();
$s3 = $s->getEnc("iso-8859-1");
$s4 = $s->getEnc("ebcdic");





 

Need a specific example? Send a request to support@chilkatsoft.com

© 2000-2007 Chilkat Software, Inc. All Rights Reserved.