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

 

 

 

 

 

 

 

Utf-8 Source Files and Unicode::String

Basic information about using utf-8 Perl source files. This allows for string literals in any language to be used with Perl.

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;

# A Unicode::String object represents a sequence of Unicode characters. Methods are
# provided to convert between various external formats (encodings) and Unicode::String
# objects, and methods are provided for common string manipulations.
use Unicode::String qw(utf8 latin1 utf16);

$u = utf8("Is féidir liom gloinne a ithe. Ní dhéanann sí dochar ar bith dom.");

# If you run this script from an MS-DOS prompt, redirect the output to a file
# because the DOS console will not display the 8bit characters correctly...
# Even though the Perl source file is utf-8, we can emit in any character encoding.
print "Latin1: ", $u->latin1, "\n";

# Commented out code to emit in other encodings...
#print "UCS-4: ",  $u->ucs4,   "\n"; # 4 byte characters
#print "UTF-16: ", $u->utf16,  "\n"; # 2 byte characters + surrogates
#print "UTF-8: ",  $u->utf8,   "\n"; # 1-4 byte characters
#print "UTF-7: ",  $u->utf7,   "\n"; # 7-bit clean format
#print "Hex: ",    $u->hex,    "\n"; # a hexadecimal string


 

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

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