6 my ($class, $name) = @_;
7 $name = $ENV{PERL_ENCODING} if @_ < 2;
8 my $enc = find_encoding($name);
9 unless (defined $enc) {
11 Carp::croak "Unknown encoding '$name'";
20 encoding - pragma to control the conversion of legacy data into Unicode
24 use encoding "iso 8859-7";
31 # $c will be "\x{3af}\x{100}", not "\x{df}\x{100}".
32 # The \xDF of ISO 8859-7 is \x{3af} in Unicode.
36 Normally when legacy 8-bit data is converted to Unicode the data is
37 expected to be Latin-1 (or EBCDIC in EBCDIC platforms). With the
38 encoding pragma you can change this default.
40 The pragma is a per script, not a per block lexical. Only the last
41 'use encoding' seen matters.
43 =head1 FUTURE POSSIBILITIES
45 The C<\x..> and C<\0...> in literals and regular expressions are not
46 affected by this pragma. They probably should. Ditto C<\N{...}>.