X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pod%2Fperlebcdic.pod;h=942526b0e937c378d234fccfcec2f76c612a0700;hb=a537debe17982e491ffa12d12441cf74a452acb2;hp=a9f1d0fc3f0677fd307645855965147a030a96fb;hpb=dc4af4bb4e5510c5f8f089792d518ae7894cfcb7;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pod/perlebcdic.pod b/pod/perlebcdic.pod index a9f1d0f..942526b 100644 --- a/pod/perlebcdic.pod +++ b/pod/perlebcdic.pod @@ -168,6 +168,27 @@ and from Latin-1 code points to EBCDIC code points For doing I/O it is suggested that you use the autotranslating features of PerlIO, see L. +Since version 5.8 Perl uses the new PerlIO I/O library. This enables +you to use different encodings per IO channel. For example you may use + + use Encode; + open($f, ">:encoding(ascii)", "test.ascii"); + print $f "Hello World!\n"; + open($f, ">:encoding(cp37)", "test.ebcdic"); + print $f "Hello World!\n"; + open($f, ">:encoding(latin1)", "test.latin1"); + print $f "Hello World!\n"; + open($f, ">:encoding(utf8)", "test.utf8"); + print $f "Hello World!\n"; + +to get two files containing "Hello World!\n" in ASCII, CP 37 EBCDIC, +ISO 8859-1 (Latin-1) (in this example identical to ASCII) respective +UTF-EBCDIC (in this example identical to normal EBCDIC). See the +documentation of Encode::PerlIO for details. + +As the PerlIO layer uses raw IO (bytes) internally, all this totally +ignores things like the type of your filesystem (ASCII or EBCDIC). + =head1 SINGLE OCTET TABLES The following tables list the ASCII and Latin 1 ordered sets including @@ -643,13 +664,13 @@ it in tr/// like so: '\060\061\062\063\064\065\066\067\070\071\263\333\334\331\332\237' ; my $ebcdic_string = $ascii_string; - eval '$ebcdic_string =~ tr/\000-\377/' . $cp_037 . '/'; + eval '$ebcdic_string =~ tr/' . $cp_037 . '/\000-\377/'; To convert from EBCDIC 037 to ASCII just reverse the order of the tr/// arguments like so: my $ascii_string = $ebcdic_string; - eval '$ascii_string = tr/' . $cp_037 . '/\000-\377/'; + eval '$ascii_string =~ tr/\000-\377/' . $cp_037 . '/'; Similarly one could take the output of the third column from recipe 0 to obtain a C<$cp_1047> table. The fourth column of the output from recipe @@ -837,7 +858,11 @@ As of perl 5.005_03 the letter range regular expression such as [A-Z] and [a-z] have been especially coded to not pick up gap characters. For example, characters such as E C that lie between I and J would not be matched by the -regular expression range C. +regular expression range C. This works in +the other direction, too, if either of the range end points is +explicitly numeric: C<[\x89-\x91]> will match C<\x8e>, even +though C<\x89> is C and C<\x91 > is C, and C<\x8e> +is a gap character from the alphabetic viewpoint. If you do want to match the alphabet gap characters in a single octet regular expression try matching the hex or octal code such @@ -1244,12 +1269,16 @@ Legacy multi byte EBCDIC code pages XXX. There may be a few system dependent issues of concern to EBCDIC Perl programmers. -=head2 OS/400 - -The PASE environment. +=head2 OS/400 =over 8 +=item PASE + +The PASE environment is runtime environment for OS/400 that can run +executables built for PowerPC AIX in OS/400, see L. PASE +is ASCII-based, not EBCDIC-based as the ILE. + =item IFS access XXX.