summaryrefslogtreecommitdiff
path: root/pod/perlebcdic.pod
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2002-02-23 23:35:03 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2002-02-23 23:35:03 +0000
commit8f94de01b0ec23d3da0be11e7e9ccad913e01fae (patch)
treef57e545feb9c77eb7f973e935aae2627c8510581 /pod/perlebcdic.pod
parent4a2e806c60950b53f59db24f137b2ce730376949 (diff)
downloadperl-8f94de01b0ec23d3da0be11e7e9ccad913e01fae.tar.gz
EBCDIC: document using Encode for character conversions.
p4raw-id: //depot/perl@14849
Diffstat (limited to 'pod/perlebcdic.pod')
-rw-r--r--pod/perlebcdic.pod26
1 files changed, 26 insertions, 0 deletions
diff --git a/pod/perlebcdic.pod b/pod/perlebcdic.pod
index 86dcba29a5..9304fc3cce 100644
--- a/pod/perlebcdic.pod
+++ b/pod/perlebcdic.pod
@@ -104,6 +104,32 @@ representation of the Unicode standard that looks very much like ASCII.
UTF-EBCDIC is an attempt to represent Unicode characters in an EBCDIC
transparent manner.
+=head Using Encode
+
+Starting from Perl 5.8 you can use the standard new module Encode
+to translate from EBCDIC to Latin-1 code points
+
+ use Encode 'from_to';
+
+ my %ebcdic = ( 176 => 'cp37', 95 => 'cp1047', 106 => 'posix-bc' );
+
+ # $a is in EBCDIC code points
+ from_to($a, $ebcdic{ord '^'}, 'latin1');
+ # $a is ISO 8859-1 code points
+
+and from Latin-1 code points to EBCDIC code points
+
+ use Encode 'from_to';
+
+ my %ebcdic = ( 176 => 'cp37', 95 => 'cp1047', 106 => 'posix-bc' );
+
+ # $a is ISO 8859-1 code points
+ from_to($a, 'latin1', $ebcdic{ord '^'});
+ # $a is in EBCDIC code points
+
+For doing I/O it is suggested that you use the autotranslating features
+of PerlIO, see L<perluniintro>.
+
=head1 SINGLE OCTET TABLES
The following tables list the ASCII and Latin 1 ordered sets including