Upgrade to Encode 0.99, from Dan Kogai.
[p5sagit/p5-mst-13.2.git] / ext / Encode / Encode.pm
index 57677e6..42bb24e 100644 (file)
 package Encode;
-
-$VERSION = 0.01;
+use strict;
+our $VERSION = do { my @r = (q$Revision: 0.99 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };
+our $DEBUG = 0;
 
 require DynaLoader;
 require Exporter;
 
-@ISA = qw(Exporter DynaLoader);
+our @ISA = qw(Exporter DynaLoader);
+
+# Public, encouraged API is exported by default
+our @EXPORT = qw (
+  encode
+  decode
+  encode_utf8
+  decode_utf8
+  find_encoding
+  encodings
+);
 
-@EXPORT_OK =
+our @EXPORT_OK =
     qw(
-       bytes_to_utf8
-       utf8_to_bytes
-       chars_to_utf8
-       utf8_to_chars
-       utf8_to_chars_check
-       bytes_to_chars
-       chars_to_bytes
+       define_encoding
        from_to
        is_utf8
-       on_utf8
-       off_utf8
-       utf_to_utf
+       is_8bit
+       is_16bit
+       utf8_upgrade
+       utf8_downgrade
+       _utf8_on
+       _utf8_off
       );
 
 bootstrap Encode ();
 
-=pod
+# Documentation moved after __END__ for speed - NI-S
 
-=head1 NAME
+use Carp;
 
-Encode - character encodings
+our $ON_EBCDIC = (ord("A") == 193);
+use Encode::Alias;
 
-=head2 TERMINOLOGY
+# Make a %Encoding package variable to allow a certain amount of cheating
+our %Encoding;
 
-=over
+our %ExtModule =
+    (
+     viscii             => 'Encode/Byte.pm',
+     'koi8-r'           => 'Encode/Byte.pm',
+     cp1047             => 'Encode/EBCDIC.pm',
+     cp37               => 'Encode/EBCDIC.pm',
+     'posix-bc'         => 'Encode/EBCDIC.pm',
+     symbol             => 'Encode/Symbol.pm',
+     dingbats           => 'Encode/Symbol.pm',
+    );
 
-=item *
+for my $k (2..11,13..16){
+    $ExtModule{"iso-8859-$k"} = 'Encode/Byte.pm';
+}
 
-I<char>: a character in the range 0..maxint (at least 2**32-1)
+for my $k (1250..1258){
+    $ExtModule{"cp$k"} = 'Encode/Byte.pm';
+}
 
-=item *
+unless ($ON_EBCDIC) { # CJK added to autoload unless EBCDIC env
+%ExtModule =(
+            %ExtModule,
+            'euc-cn'           => 'Encode/CN.pm',
+            gb2312             => 'Encode/CN.pm',
+            gb12345            => 'Encode/CN.pm',
+            gbk                => 'Encode/CN.pm',
+            cp936              => 'Encode/CN.pm',
+            'iso-ir-165'       => 'Encode/CN.pm',
+            'euc-jp'           => 'Encode/JP.pm',
+            'iso-2022-jp'      => 'Encode/JP.pm',
+            'iso-2022-jp-1'    => 'Encode/JP.pm',
+            '7bit-jis'         => 'Encode/JP.pm',
+            shiftjis           => 'Encode/JP.pm',
+            macjapan           => 'Encode/JP.pm',
+            cp932              => 'Encode/JP.pm',
+            'euc-kr'           => 'Encode/KR.pm',
+            ksc5601            => 'Encode/KR.pm',
+            cp949              => 'Encode/KR.pm',
+            big5               => 'Encode/TW.pm',
+            'big5-hkscs'       => 'Encode/TW.pm',
+            cp950              => 'Encode/TW.pm',
+            gb18030            => 'Encode/HanExtra.pm',
+            big5plus           => 'Encode/HanExtra.pm',
+            'euc-tw'           => 'Encode/HanExtra.pm',
+            );
+}
 
-I<byte>: a character in the range 0..255
+for my $k (qw(centeuro croatian cyrillic dingbats greek
+             iceland roman rumanian sami 
+             thai turkish  ukraine))
+{
+    $ExtModule{"mac$k"} = 'Encode/Byte.pm';
+}
 
-=back
 
-The marker [INTERNAL] marks Internal Implementation Details, in
-general meant only for those who think they know what they are doing,
-and such details may change in future releases.
+sub encodings
+{
+    my $class = shift;
+    my @modules = (@_ and $_[0] eq ":all") ? values %ExtModule : @_;
+    for my $m (@modules)
+    {
+       $DEBUG and warn "about to require $m;";
+       eval { require $m; };
+    }
+    return
+       map({$_->[0]} 
+           sort({$a->[1] cmp $b->[1]}
+                map({[$_, lc $_]} 
+                    grep({ $_ ne 'Internal' }  keys %Encoding))));
+}
 
-=head2 bytes
+sub define_encoding
+{
+    my $obj  = shift;
+    my $name = shift;
+    $Encoding{$name} = $obj;
+    my $lc = lc($name);
+    define_alias($lc => $obj) unless $lc eq $name;
+    while (@_)
+    {
+       my $alias = shift;
+       define_alias($alias,$obj);
+    }
+    return $obj;
+}
 
-=over 4
+sub getEncoding
+{
+    my ($class,$name,$skip_external) = @_;
+    my $enc;
+    if (ref($name) && $name->can('new_sequence'))
+    {
+       return $name;
+    }
+    my $lc = lc $name;
+    if (exists $Encoding{$name})
+    {
+       return $Encoding{$name};
+    }
+    if (exists $Encoding{$lc})
+    {
+       return $Encoding{$lc};
+    }
+
+    my $oc = $class->find_alias($name);
+    return $oc if defined $oc;
+
+    $oc = $class->find_alias($lc) if $lc ne $name;
+    return $oc if defined $oc;
+
+    if (!$skip_external and exists $ExtModule{$lc})
+    {
+       eval{ require $ExtModule{$lc}; };
+       return $Encoding{$name} if exists $Encoding{$name};
+    }
+
+    return;
+}
 
-=item *
+sub find_encoding
+{
+    my ($name,$skip_external) = @_;
+    return __PACKAGE__->getEncoding($name,$skip_external);
+}
 
-        bytes_to_utf8(STRING [, FROM])
+sub encode
+{
+    my ($name,$string,$check) = @_;
+    my $enc = find_encoding($name);
+    croak("Unknown encoding '$name'") unless defined $enc;
+    my $octets = $enc->encode($string,$check);
+    return undef if ($check && length($string));
+    return $octets;
+}
 
-The bytes in STRING are recoded in-place into UTF-8.  If no FROM is
-specified the bytes are expected to be encoded in US-ASCII or ISO
-8859-1 (Latin 1).  Returns the new size of STRING, or C<undef> if
-there's a failure.
+sub decode
+{
+    my ($name,$octets,$check) = @_;
+    my $enc = find_encoding($name);
+    croak("Unknown encoding '$name'") unless defined $enc;
+    my $string = $enc->decode($octets,$check);
+    $_[1] = $octets if $check;
+    return $string;
+}
 
-[INTERNAL] Also the UTF-8 flag of STRING is turned on.        
+sub from_to
+{
+    my ($string,$from,$to,$check) = @_;
+    my $f = find_encoding($from);
+    croak("Unknown encoding '$from'") unless defined $f;
+    my $t = find_encoding($to);
+    croak("Unknown encoding '$to'") unless defined $t;
+    my $uni = $f->decode($string,$check);
+    return undef if ($check && length($string));
+    $string = $t->encode($uni,$check);
+    return undef if ($check && length($uni));
+    return length($_[0] = $string);
+}
 
-=item *
+sub encode_utf8
+{
+    my ($str) = @_;
+  utf8::encode($str);
+    return $str;
+}
 
-        utf8_to_bytes(STRING [, TO [, CHECK]])
+sub decode_utf8
+{
+    my ($str) = @_;
+    return undef unless utf8::decode($str);
+    return $str;
+}
 
-The UTF-8 in STRING is decoded in-place into bytes.  If no TO encoding
-is specified the bytes are expected to be encoded in US-ASCII or ISO
-8859-1 (Latin 1).  Returns the new size of STRING, or C<undef> if
-there's a failure.
+require Encode::Encoding;
+require Encode::XS;
+require Encode::Internal;
+require Encode::Unicode;
+require Encode::utf8;
+require Encode::10646_1;
+require Encode::ucs2_le;
 
-What if there are characters > 255?  What if the UTF-8 in STRING is
-malformed?  See L</"Handling Malformed Data">.
+1;
 
-[INTERNAL] The UTF-8 flag of STRING is not checked.
+__END__
 
-=back
+=head1 NAME
 
-=head2 chars
+Encode - character encodings
 
-=over 4
+=head1 SYNOPSIS
+
+    use Encode;
 
-=item *
+=head1 DESCRIPTION
 
-        chars_to_utf8(STRING)
+The C<Encode> module provides the interfaces between Perl's strings
+and the rest of the system.  Perl strings are sequences of B<characters>.
 
-The chars in STRING are encoded in-place into UTF-8.  Returns the new
-size of STRING, or C<undef> if there's a failure.
+To find more about character encodings, please consult
+L<Encode::Details>. This document focuses on programming references.
 
-No assumptions are made on the encoding of the chars.  If you want to
-assume that the chars are Unicode and to trap illegal Unicode
-characters, you must use C<from_to('Unicode', ...)>.
+=head1 PERL ENCODING API
 
-[INTERNAL] Also the UTF-8 flag of STRING is turned on.
+=head2 Generic Encoding Interface
 
 =over 4
 
-=item *
+=item $bytes  = encode(ENCODING, $string[, CHECK])
 
-        utf8_to_chars(STRING)
+Encodes string from Perl's internal form into I<ENCODING> and returns
+a sequence of octets.  For CHECK see L</"Handling Malformed Data">.
 
-The UTF-8 in STRING is decoded in-place into chars.  Returns the new
-size of STRING, or C<undef> if there's a failure. 
+For example to convert (internally UTF-8 encoded) Unicode data
+to octets:
 
-If the UTF-8 in STRING is malformed C<undef> is returned, and also an
-optional lexical warning (category utf8) is given.
+       $octets = encode("utf8", $unicode);
+
+=item $string = decode(ENCODING, $bytes[, CHECK])
+
+Decode sequence of octets assumed to be in I<ENCODING> into Perl's
+internal form and returns the resulting string.  For CHECK see
+L</"Handling Malformed Data">.
 
-[INTERNAL] The UTF-8 flag of STRING is not checked.
+For example to convert ISO-8859-1 data to UTF-8:
 
-=item *
+       $utf8 = decode("latin1", $latin1);
 
-        utf8_to_chars_check(STRING [, CHECK])
+=item from_to($string, FROM_ENCODING, TO_ENCODING[, CHECK])
 
-(Note that special naming of this interface since a two-argument
-utf8_to_chars() has different semantics.)
+Convert B<in-place> the data between two encodings.  How did the data
+in $string originally get to be in FROM_ENCODING?  Either using
+encode() or through PerlIO: See L</"Encoding and IO">.  For CHECK
+see L</"Handling Malformed Data">.
 
-The UTF-8 in STRING is decoded in-place into chars.  Returns the new
-size of STRING, or C<undef> if there is a failure.
+For example to convert ISO-8859-1 data to UTF-8:
 
-If the UTF-8 in STRING is malformed?  See L</"Handling Malformed Data">.
+       from_to($data, "iso-8859-1", "utf-8");
 
-[INTERNAL] The UTF-8 flag of STRING is not checked.
+and to convert it back:
+
+       from_to($data, "utf-8", "iso-8859-1");
+
+Note that because the conversion happens in place, the data to be
+converted cannot be a string constant, it must be a scalar variable.
 
 =back
 
-=head2 chars With Encoding
+=head2 Handling Malformed Data
 
-=over 4
+If CHECK is not set, C<undef> is returned.  If the data is supposed to
+be UTF-8, an optional lexical warning (category utf8) is given.  If
+CHECK is true but not a code reference, dies.
 
-=item *
+It would desirable to have a way to indicate that transform should use
+the encodings "replacement character" - no such mechanism is defined yet.
 
-        chars_to_utf8(STRING, FROM [, CHECK])
+It is also planned to allow I<CHECK> to be a code reference.
 
-The chars in STRING encoded in FROM are recoded in-place into UTF-8.
-Returns the new size of STRING, or C<undef> if there's a failure.
+This is not yet implemented as there are design issues with what its
+arguments should be and how it returns its results.
 
-No assumptions are made on the encoding of the chars.  If you want to
-assume that the chars are Unicode and to trap illegal Unicode
-characters, you must use C<from_to('Unicode', ...)>.
+=over 4
 
-[INTERNAL] Also the UTF-8 flag of STRING is turned on.
+=item Scheme 1
 
-=item *
+Passed remaining fragment of string being processed.
+Modifies it in place to remove bytes/characters it can understand
+and returns a string used to represent them.
+e.g.
 
-        utf8_to_chars(STRING, TO [, CHECK])
+ sub fixup {
+   my $ch = substr($_[0],0,1,'');
+   return sprintf("\x{%02X}",ord($ch);
+ }
 
-The UTF-8 in STRING is decoded in-place into chars encoded in TO.
-Returns the new size of STRING, or C<undef> if there's a failure.
+This scheme is close to how underlying C code for Encode works, but gives
+the fixup routine very little context.
 
-If the UTF-8 in STRING is malformed?  See L</"Handling Malformed Data">.
+=item Scheme 2
 
-[INTERNAL] The UTF-8 flag of STRING is not checked.
+Passed original string, and an index into it of the problem area, and
+output string so far.  Appends what it will to output string and
+returns new index into original string.  For example:
 
-=item *
+ sub fixup {
+   # my ($s,$i,$d) = @_;
+   my $ch = substr($_[0],$_[1],1);
+   $_[2] .= sprintf("\x{%02X}",ord($ch);
+   return $_[1]+1;
+ }
 
-       bytes_to_chars(STRING, FROM [, CHECK])
+This scheme gives maximal control to the fixup routine but is more
+complicated to code, and may need internals of Encode to be tweaked to
+keep original string intact.
 
-The bytes in STRING encoded in FROM are recoded in-place into chars.
-Returns the new size of STRING in bytes, or C<undef> if there's a
-failure.
+=item Other Schemes
 
-If the mapping is impossible?  See L</"Handling Malformed Data">.
+Hybrids of above.
 
-=item *
+Multiple return values rather than in-place modifications.
 
-       chars_to_bytes(STRING, TO [, CHECK])
+Index into the string could be C<pos($str)> allowing C<s/\G...//>.
 
-The chars in STRING are recoded in-place to bytes encoded in TO.
-Returns the new size of STRING in bytes, or C<undef> if there's a
-failure.
+=back
 
-If the mapping is impossible?  See L</"Handling Malformed Data">.
+=head2 UTF-8 / utf8
 
-=item *
+The Unicode consortium defines the UTF-8 standard as a way of encoding
+the entire Unicode repertoire as sequences of octets.  This encoding is
+expected to become very widespread. Perl can use this form internally
+to represent strings, so conversions to and from this form are
+particularly efficient (as octets in memory do not have to change,
+just the meta-data that tells Perl how to treat them).
+
+=over 4
 
-        from_to(STRING, FROM, TO [, CHECK])
+=item $bytes = encode_utf8($string);
 
-The chars in STRING encoded in FROM are recoded in-place into TO.
-Returns the new size of STRING, or C<undef> if there's a failure.
+The characters that comprise string are encoded in Perl's superset of UTF-8
+and the resulting octets returned as a sequence of bytes. All possible
+characters have a UTF-8 representation so this function cannot fail.
 
-If mapping between the encodings is impossible?
-See L</"Handling Malformed Data">.
+=item $string = decode_utf8($bytes [, CHECK]);
 
-[INTERNAL] If TO is UTF-8, also the UTF-8 flag of STRING is turned on.
+The sequence of octets represented by $bytes is decoded from UTF-8
+into a sequence of logical characters. Not all sequences of octets
+form valid UTF-8 encodings, so it is possible for this call to fail.
+For CHECK see L</"Handling Malformed Data">.
 
 =back
 
-=head2 Testing For UTF-8
+=head2 Listing available encodings
 
-=over 4
+  use Encode;
+  @list = Encode->encodings();
 
-=item *
+Returns a list of the canonical names of the available encodings that
+are loaded.  To get a list of all available encodings including the
+ones that are not loaded yet, say
 
-        is_utf8(STRING [, CHECK])
+  @all_encodings = Encode->encodings(":all");
 
-[INTERNAL] Test whether the UTF-8 flag is turned on in the STRING.
-If CHECK is true, also checks the data in STRING for being
-well-formed UTF-8.  Returns true if successful, false otherwise.
+Or you can give the name of specific module.
 
-=back
+  @with_jp = Encode->encodings("Encode/JP.pm");
 
-=head2 Toggling UTF-8-ness
+Note in this case you have to say C<"Encode/JP.pm"> instead of
+C<"Encode::JP">.
 
-=over 4
+To find which encodings are supported by this package in details, 
+see L<Encode::Supported>.
 
-=item *
+=head2 Defining Aliases
 
-        on_utf8(STRING)
+  use Encode;
+  use Encode::Alias;
+  define_alias(newName => ENCODING);
 
-[INTERNAL] Turn on the UTF-8 flag in STRING.  The data in STRING is
-B<not> checked for being well-formed UTF-8.  Do not use unless you
-B<know> that the STRING is well-formed UTF-8.  Returns the previous
-state of the UTF-8 flag (so please don't test the return value as
-I<not> success or failure), or C<undef> if STRING is not a string.
+Allows newName to be used as am alias for ENCODING. ENCODING may be
+either the name of an encoding or and encoding object (as above).
 
-=item *
+See L<Encode::Alias> on details.
 
-        off_utf8(STRING)
+=head1 Defining Encodings
 
-[INTERNAL] Turn off the UTF-8 flag in STRING.  Do not use frivolously.
-Returns the previous state of the UTF-8 flag (so please don't test the
-return value as I<not> success or failure), or C<undef> if STRING is
-not a string.
+    use Encode qw(define_alias);
+    define_encoding($object, 'canonicalName' [, alias...]);
 
-=back
+Causes I<canonicalName> to be associated with I<$object>.  The object
+should provide the interface described in L<Encode::Encoding>
+below.  If more than two arguments are provided then additional
+arguments are taken as aliases for I<$object> as for C<define_alias>.
 
-=head2 UTF-16 and UTF-32 Encodings
+=head1 Encoding and IO
 
-=over 4
+It is very common to want to do encoding transformations when
+reading or writing files, network connections, pipes etc.
+If Perl is configured to use the new 'perlio' IO system then
+C<Encode> provides a "layer" (See L<perliol>) which can transform
+data as it is read or written.
 
-=item *
+Here is how the blind poet would modernise the encoding:
 
-        utf_to_utf(STRING, FROM, TO [, CHECK])
+    use Encode;
+    open(my $iliad,'<:encoding(iso-8859-7)','iliad.greek');
+    open(my $utf8,'>:utf8','iliad.utf8');
+    my @epic = <$iliad>;
+    print $utf8 @epic;
+    close($utf8);
+    close($illiad);
 
-The data in STRING is converted from Unicode Transfer Encoding FROM to
-Unicode Transfer Encoding TO.  Both FROM and TO may be any of the
-following tags (case-insensitive, with or without 'utf' or 'utf-' prefix):
+In addition the new IO system can also be configured to read/write
+UTF-8 encoded characters (as noted above this is efficient):
 
-        tag             meaning
+    open(my $fh,'>:utf8','anything');
+    print $fh "Any \x{0021} string \N{SMILEY FACE}\n";
 
-        '7'             UTF-7
-        '8'             UTF-8
-        '16be'          UTF-16 big-endian
-        '16le'          UTF-16 little-endian
-        '16'            UTF-16 native-endian
-        '32be'          UTF-32 big-endian
-        '32le'          UTF-32 little-endian
-        '32'            UTF-32 native-endian
+Either of the above forms of "layer" specifications can be made the default
+for a lexical scope with the C<use open ...> pragma. See L<open>.
 
-UTF-16 is also known as UCS-2, 16 bit or 2-byte chunks, and UTF-32 as
-UCS-4, 32-bit or 4-byte chunks.  Returns the new size of STRING, or
-C<undef> is there's a failure.
+Once a handle is open is layers can be altered using C<binmode>.
 
-If FROM is UTF-8 and the UTF-8 in STRING is malformed?  See
-L</"Handling Malformed Data">.
+Without any such configuration, or if Perl itself is built using
+system's own IO, then write operations assume that file handle accepts
+only I<bytes> and will C<die> if a character larger than 255 is
+written to the handle. When reading, each octet from the handle
+becomes a byte-in-a-character. Note that this default is the same
+behaviour as bytes-only languages (including Perl before v5.6) would
+have, and is sufficient to handle native 8-bit encodings
+e.g. iso-8859-1, EBCDIC etc. and any legacy mechanisms for handling
+other encodings and binary data.
 
-[INTERNAL] Even if CHECK is true and FROM is UTF-8, the UTF-8 flag of
-STRING is not checked.  If TO is UTF-8, also the UTF-8 flag of STRING is
-turned on.  Identical FROM and TO are fine.
+In other cases it is the programs responsibility to transform
+characters into bytes using the API above before doing writes, and to
+transform the bytes read from a handle into characters before doing
+"character operations" (e.g. C<lc>, C</\W+/>, ...).
 
-=back
+You can also use PerlIO to convert larger amounts of data you don't
+want to bring into memory.  For example to convert between ISO-8859-1
+(Latin 1) and UTF-8 (or UTF-EBCDIC in EBCDIC machines):
 
-=head2 Handling Malformed Data
+    open(F, "<:encoding(iso-8859-1)", "data.txt") or die $!;
+    open(G, ">:utf8",                 "data.utf") or die $!;
+    while (<F>) { print G }
 
-If CHECK is not set, C<undef> is returned.  If the data is supposed to
-be UTF-8, an optional lexical warning (category utf8) is given.  If
-CHECK is true but not a code reference, dies.  If CHECK is a code
-reference, it is called with the arguments
+    # Could also do "print G <F>" but that would pull
+    # the whole file into memory just to write it out again.
 
-       (MALFORMED_STRING, STRING_FROM_SO_FAR, STRING_TO_SO_FAR)
+More examples:
 
-Two return values are expected from the call: the string to be used in
-the result string in place of the malformed section, and the length of
-the malformed section in bytes.
+    open(my $f, "<:encoding(cp1252)")
+    open(my $g, ">:encoding(iso-8859-2)")
+    open(my $h, ">:encoding(latin9)")       # iso-8859-15
 
-=cut
+See L<PerlIO> for more information.
 
-sub bytes_to_utf8 {
-    &_bytes_to_utf8;
-}
+See also L<encoding> for how to change the default encoding of the
+data in your script.
 
-sub utf8_to_bytes {
-    &_utf8_to_bytes;
-}
+=head1 Messing with Perl's Internals
 
-sub chars_to_utf8 {
-    &C_to_utf8;
-}
+The following API uses parts of Perl's internals in the current
+implementation.  As such they are efficient, but may change.
 
-sub utf8_to_chars {
-    &_utf8_to_chars;
-}
+=over 4
 
-sub utf8_to_chars_check {
-    &_utf8_to_chars_check;
-}
+=item is_utf8(STRING [, CHECK])
 
-sub bytes_to_chars {
-    &_bytes_to_chars;
-}
+[INTERNAL] Test whether the UTF-8 flag is turned on in the STRING.
+If CHECK is true, also checks the data in STRING for being well-formed
+UTF-8.  Returns true if successful, false otherwise.
 
-sub chars_to_bytes {
-    &_chars_to_bytes;
-}
+=item _utf8_on(STRING)
 
-sub from_to {
-    &_from_to;
-}
+[INTERNAL] Turn on the UTF-8 flag in STRING.  The data in STRING is
+B<not> checked for being well-formed UTF-8.  Do not use unless you
+B<know> that the STRING is well-formed UTF-8.  Returns the previous
+state of the UTF-8 flag (so please don't test the return value as
+I<not> success or failure), or C<undef> if STRING is not a string.
 
-sub is_utf8 {
-    &_is_utf8;
-}
+=item _utf8_off(STRING)
 
-sub on_utf8 {
-    &_on_utf8;
-}
+[INTERNAL] Turn off the UTF-8 flag in STRING.  Do not use frivolously.
+Returns the previous state of the UTF-8 flag (so please don't test the
+return value as I<not> success or failure), or C<undef> if STRING is
+not a string.
 
-sub off_utf8 {
-    &_off_utf8;
-}
+=back
 
-sub utf_to_utf {
-    &_utf_to_utf;
-}
+=head1 SEE ALSO
 
+L<Encode::Details>, 
+L<Encode::Encoding>,
+L<Encode::Supported>,
+L<PerlIO>, 
+L<encoding>,
+L<perlebcdic>, 
+L<perlfunc/open>, 
+L<perlunicode>, 
+L<utf8>, 
+the Perl Unicode Mailing List E<lt>perl-unicode@perl.orgE<gt>
+
+=cut