@@ -174,6 +174,40 @@ Perl code:
174
174
Although one would expect the quantities $y and $z to be the same and equal
175
175
to 100000 they will differ and instead will be 0 and 100000 respectively.
176
176
177
+ =head2 Using PerlIO and different encodings on ASCII and EBCDIC partitions
178
+
179
+ Since version 5.8 Perl uses the new PerlIO on BS2000. This enables
180
+ you using different encodings per IO channel. For example you may use
181
+
182
+ use Encode;
183
+ open($f, ">:encoding(ascii)", "test.ascii");
184
+ print $f "Hello World!\n";
185
+ open($f, ">:encoding(posix-bc)", "test.ebcdic");
186
+ print $f "Hello World!\n";
187
+ open($f, ">:encoding(latin1)", "test.latin1");
188
+ print $f "Hello World!\n";
189
+ open($f, ">:encoding(utf8)", "test.utf8");
190
+ print $f "Hello World!\n";
191
+
192
+ to get two files containing "Hello World!\n" in ASCII, EBCDIC, ISO
193
+ Latin-1 (in this example identical to ASCII) respective UTF-EBCDIC (in
194
+ this example identical to normal EBCDIC). See the documentation of
195
+ Encode::PerlIO for details.
196
+
197
+ As the PerlIO layer uses raw IO internally, all this totally ignores
198
+ the type of your filesystem (ASCII or EBCDIC) and the IO_CONVERSION
199
+ environment variable. If you want to get the old behavior, that the
200
+ BS2000 IO functions determine conversion depending on the filesystem
201
+ PerlIO still is your friend. You use IO_CONVERSION as usual and tell
202
+ Perl, that it should use the native IO layer:
203
+
204
+ export IO_CONVERSION=YES
205
+ export PERLIO=stdio
206
+
207
+ Now your IO would be ASCII on ASCII partitions and EBCDIC on EBCDIC
208
+ partitions. See the documentation of PerlIO (without C<Encode::>!)
209
+ for further posibilities.
210
+
177
211
=head1 AUTHORS
178
212
179
213
Thomas Dorner
0 commit comments