���ѧۧݧ�ӧ�� �ާ֧ߧ֧էا֧� - ���֧էѧܧ�ڧ��ӧѧ�� - /home/ukubnwwtacc0unt/chapelbellstudios.com/uploads/cover/Encode.zip
���ѧ٧ѧ�
PK Co�\�FB � � _PM.e2xnu �[��� package Encode::$_Name_; our $VERSION = "0.01"; use Encode; use XSLoader; XSLoader::load(__PACKAGE__,$VERSION); 1; __END__ =head1 NAME Encode::$_Name_ - New Encoding =head1 SYNOPSIS You got to fill this in! =head1 SEE ALSO L<Encode> =cut PK Co�\"0k^# # Unicode/UTF7.pmnu �[��� # # $Id: UTF7.pm,v 2.10 2017/06/10 17:23:50 dankogai Exp $ # package Encode::Unicode::UTF7; use strict; use warnings; use parent qw(Encode::Encoding); __PACKAGE__->Define('UTF-7'); our $VERSION = do { my @r = ( q$Revision: 2.10 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; use MIME::Base64; use Encode qw(find_encoding); # # Algorithms taken from Unicode::String by Gisle Aas # our $OPTIONAL_DIRECT_CHARS = 1; my $specials = quotemeta "\'(),-./:?"; $OPTIONAL_DIRECT_CHARS and $specials .= quotemeta "!\"#$%&*;<=>@[]^_`{|}"; # \s will not work because it matches U+3000 DEOGRAPHIC SPACE # We use qr/[\n\r\t\ ] instead my $re_asis = qr/(?:[\n\r\t\ A-Za-z0-9$specials])/; my $re_encoded = qr/(?:[^\n\r\t\ A-Za-z0-9$specials])/; my $e_utf16 = find_encoding("UTF-16BE"); sub needs_lines { 1 } sub encode($$;$) { my ( $obj, $str, $chk ) = @_; return undef unless defined $str; my $len = length($str); pos($str) = 0; my $bytes = substr($str, 0, 0); # to propagate taintedness while ( pos($str) < $len ) { if ( $str =~ /\G($re_asis+)/ogc ) { my $octets = $1; utf8::downgrade($octets); $bytes .= $octets; } elsif ( $str =~ /\G($re_encoded+)/ogsc ) { if ( $1 eq "+" ) { $bytes .= "+-"; } else { my $s = $1; my $base64 = encode_base64( $e_utf16->encode($s), '' ); $base64 =~ s/=+$//; $bytes .= "+$base64-"; } } else { die "This should not happen! (pos=" . pos($str) . ")"; } } $_[1] = '' if $chk; return $bytes; } sub decode($$;$) { use re 'taint'; my ( $obj, $bytes, $chk ) = @_; return undef unless defined $bytes; my $len = length($bytes); my $str = substr($bytes, 0, 0); # to propagate taintedness; pos($bytes) = 0; no warnings 'uninitialized'; while ( pos($bytes) < $len ) { if ( $bytes =~ /\G([^+]+)/ogc ) { $str .= $1; } elsif ( $bytes =~ /\G\+-/ogc ) { $str .= "+"; } elsif ( $bytes =~ /\G\+([A-Za-z0-9+\/]+)-?/ogsc ) { my $base64 = $1; my $pad = length($base64) % 4; $base64 .= "=" x ( 4 - $pad ) if $pad; $str .= $e_utf16->decode( decode_base64($base64) ); } elsif ( $bytes =~ /\G\+/ogc ) { $^W and warn "Bad UTF7 data escape"; $str .= "+"; } else { die "This should not happen " . pos($bytes); } } $_[1] = '' if $chk; return $str; } 1; __END__ =head1 NAME Encode::Unicode::UTF7 -- UTF-7 encoding =head1 SYNOPSIS use Encode qw/encode decode/; $utf7 = encode("UTF-7", $utf8); $utf8 = decode("UTF-7", $ucs2); =head1 ABSTRACT This module implements UTF-7 encoding documented in RFC 2152. UTF-7, as its name suggests, is a 7-bit re-encoded version of UTF-16BE. It is designed to be MTA-safe and expected to be a standard way to exchange Unicoded mails via mails. But with the advent of UTF-8 and 8-bit compliant MTAs, UTF-7 is hardly ever used. UTF-7 was not supported by Encode until version 1.95 because of that. But Unicode::String, a module by Gisle Aas which adds Unicode supports to non-utf8-savvy perl did support UTF-7, the UTF-7 support was added so Encode can supersede Unicode::String 100%. =head1 In Practice When you want to encode Unicode for mails and web pages, however, do not use UTF-7 unless you are sure your recipients and readers can handle it. Very few MUAs and WWW Browsers support these days (only Mozilla seems to support one). For general cases, use UTF-8 for message body and MIME-Header for header instead. =head1 SEE ALSO L<Encode>, L<Encode::Unicode>, L<Unicode::String> RFC 2781 L<http://www.ietf.org/rfc/rfc2152.txt> =cut PK Co�\1H�� � TW.pmnu �[��� package Encode::TW; BEGIN { if ( ord("A") == 193 ) { die "Encode::TW not supported on EBCDIC\n"; } } use strict; use warnings; use Encode; our $VERSION = do { my @r = ( q$Revision: 2.3 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; use XSLoader; XSLoader::load( __PACKAGE__, $VERSION ); 1; __END__ =head1 NAME Encode::TW - Taiwan-based Chinese Encodings =head1 SYNOPSIS use Encode qw/encode decode/; $big5 = encode("big5", $utf8); # loads Encode::TW implicitly $utf8 = decode("big5", $big5); # ditto =head1 DESCRIPTION This module implements tradition Chinese charset encodings as used in Taiwan and Hong Kong. Encodings supported are as follows. Canonical Alias Description -------------------------------------------------------------------- big5-eten /\bbig-?5$/i Big5 encoding (with ETen extensions) /\bbig5-?et(en)?$/i /\btca-?big5$/i big5-hkscs /\bbig5-?hk(scs)?$/i /\bhk(scs)?-?big5$/i Big5 + Cantonese characters in Hong Kong MacChineseTrad Big5 + Apple Vendor Mappings cp950 Code Page 950 = Big5 + Microsoft vendor mappings -------------------------------------------------------------------- To find out how to use this module in detail, see L<Encode>. =head1 NOTES Due to size concerns, C<EUC-TW> (Extended Unix Character), C<CCCII> (Chinese Character Code for Information Interchange), C<BIG5PLUS> (CMEX's Big5+) and C<BIG5EXT> (CMEX's Big5e) are distributed separately on CPAN, under the name L<Encode::HanExtra>. That module also contains extra China-based encodings. =head1 BUGS Since the original C<big5> encoding (1984) is not supported anywhere (glibc and DOS-based systems uses C<big5> to mean C<big5-eten>; Microsoft uses C<big5> to mean C<cp950>), a conscious decision was made to alias C<big5> to C<big5-eten>, which is the de facto superset of the original big5. The C<CNS11643> encoding files are not complete. For common C<CNS11643> manipulation, please use C<EUC-TW> in L<Encode::HanExtra>, which contains planes 1-7. The ASCII region (0x00-0x7f) is preserved for all encodings, even though this conflicts with mappings by the Unicode Consortium. =head1 SEE ALSO L<Encode> =cut PK Co�\a��M� � KR/2022_KR.pmnu �[��� package Encode::KR::2022_KR; use strict; use warnings; our $VERSION = do { my @r = ( q$Revision: 2.4 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; use Encode qw(:fallbacks); use parent qw(Encode::Encoding); __PACKAGE__->Define('iso-2022-kr'); sub needs_lines { 1 } sub perlio_ok { return 0; # for the time being } sub decode { my ( $obj, $str, $chk ) = @_; return undef unless defined $str; my $res = $str; my $residue = iso_euc( \$res ); # This is for PerlIO $_[1] = $residue if $chk; return Encode::decode( 'euc-kr', $res, FB_PERLQQ ); } sub encode { my ( $obj, $utf8, $chk ) = @_; return undef unless defined $utf8; # empty the input string in the stack so perlio is ok $_[1] = '' if $chk; my $octet = Encode::encode( 'euc-kr', $utf8, FB_PERLQQ ); euc_iso( \$octet ); return $octet; } use Encode::CJKConstants qw(:all); # ISO<->EUC sub iso_euc { my $r_str = shift; $$r_str =~ s/$RE{'2022_KR'}//gox; # remove the designator $$r_str =~ s{ # replace characters in GL \x0e # between SO(\x0e) and SI(\x0f) ([^\x0f]*) # with characters in GR \x0f } { my $out= $1; $out =~ tr/\x21-\x7e/\xa1-\xfe/; $out; }geox; my ($residue) = ( $$r_str =~ s/(\e.*)$//so ); return $residue; } sub euc_iso { no warnings qw(uninitialized); my $r_str = shift; substr( $$r_str, 0, 0 ) = $ESC{'2022_KR'}; # put the designator at the beg. $$r_str =~ s{ # move KS X 1001 characters in GR to GL ($RE{EUC_C}+) # and enclose them with SO and SI }{ my $str = $1; $str =~ tr/\xA1-\xFE/\x21-\x7E/; "\x0e" . $str . "\x0f"; }geox; $$r_str; } 1; __END__ =head1 NAME Encode::KR::2022_KR -- internally used by Encode::KR =cut PK Co�\f\�� � Changes.e2xnu �[��� # # $Id: Changes.e2x,v 2.0 2004/05/16 20:55:15 dankogai Exp $ # Revision history for Perl extension Encode::$_Name_. # 0.01 $_Now_ Autogenerated by enc2xs version $_Version_. PK Co�\���(g# g# Encoding.pmnu �[��� package Encode::Encoding; # Base class for classes which implement encodings use strict; use warnings; our $VERSION = do { my @r = ( q$Revision: 2.8 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; our @CARP_NOT = qw(Encode Encode::Encoder); use Carp (); use Encode (); use Encode::MIME::Name; use constant DEBUG => !!$ENV{PERL_ENCODE_DEBUG}; sub Define { my $obj = shift; my $canonical = shift; $obj = bless { Name => $canonical }, $obj unless ref $obj; # warn "$canonical => $obj\n"; Encode::define_encoding( $obj, $canonical, @_ ); } sub name { return shift->{'Name'} } sub mime_name { return Encode::MIME::Name::get_mime_name(shift->name); } sub renew { my $self = shift; my $clone = bless {%$self} => ref($self); $clone->{renewed}++; # so the caller can see it DEBUG and warn $clone->{renewed}; return $clone; } sub renewed { return $_[0]->{renewed} || 0 } *new_sequence = \&renew; sub needs_lines { 0 } sub perlio_ok { return eval { require PerlIO::encoding } ? 1 : 0; } # (Temporary|legacy) methods sub toUnicode { shift->decode(@_) } sub fromUnicode { shift->encode(@_) } # # Needs to be overloaded or just croak # sub encode { my $obj = shift; my $class = ref($obj) ? ref($obj) : $obj; Carp::croak( $class . "->encode() not defined!" ); } sub decode { my $obj = shift; my $class = ref($obj) ? ref($obj) : $obj; Carp::croak( $class . "->encode() not defined!" ); } sub DESTROY { } 1; __END__ =head1 NAME Encode::Encoding - Encode Implementation Base Class =head1 SYNOPSIS package Encode::MyEncoding; use parent qw(Encode::Encoding); __PACKAGE__->Define(qw(myCanonical myAlias)); =head1 DESCRIPTION As mentioned in L<Encode>, encodings are (in the current implementation at least) defined as objects. The mapping of encoding name to object is via the C<%Encode::Encoding> hash. Though you can directly manipulate this hash, it is strongly encouraged to use this base class module and add encode() and decode() methods. =head2 Methods you should implement You are strongly encouraged to implement methods below, at least either encode() or decode(). =over 4 =item -E<gt>encode($string [,$check]) MUST return the octet sequence representing I<$string>. =over 2 =item * If I<$check> is true, it SHOULD modify I<$string> in place to remove the converted part (i.e. the whole string unless there is an error). If perlio_ok() is true, SHOULD becomes MUST. =item * If an error occurs, it SHOULD return the octet sequence for the fragment of string that has been converted and modify $string in-place to remove the converted part leaving it starting with the problem fragment. If perlio_ok() is true, SHOULD becomes MUST. =item * If I<$check> is false then C<encode> MUST make a "best effort" to convert the string - for example, by using a replacement character. =back =item -E<gt>decode($octets [,$check]) MUST return the string that I<$octets> represents. =over 2 =item * If I<$check> is true, it SHOULD modify I<$octets> in place to remove the converted part (i.e. the whole sequence unless there is an error). If perlio_ok() is true, SHOULD becomes MUST. =item * If an error occurs, it SHOULD return the fragment of string that has been converted and modify $octets in-place to remove the converted part leaving it starting with the problem fragment. If perlio_ok() is true, SHOULD becomes MUST. =item * If I<$check> is false then C<decode> should make a "best effort" to convert the string - for example by using Unicode's "\x{FFFD}" as a replacement character. =back =back If you want your encoding to work with L<encoding> pragma, you should also implement the method below. =over 4 =item -E<gt>cat_decode($destination, $octets, $offset, $terminator [,$check]) MUST decode I<$octets> with I<$offset> and concatenate it to I<$destination>. Decoding will terminate when $terminator (a string) appears in output. I<$offset> will be modified to the last $octets position at end of decode. Returns true if $terminator appears output, else returns false. =back =head2 Other methods defined in Encode::Encodings You do not have to override methods shown below unless you have to. =over 4 =item -E<gt>name Predefined As: sub name { return shift->{'Name'} } MUST return the string representing the canonical name of the encoding. =item -E<gt>mime_name Predefined As: sub mime_name{ return Encode::MIME::Name::get_mime_name(shift->name); } MUST return the string representing the IANA charset name of the encoding. =item -E<gt>renew Predefined As: sub renew { my $self = shift; my $clone = bless { %$self } => ref($self); $clone->{renewed}++; return $clone; } This method reconstructs the encoding object if necessary. If you need to store the state during encoding, this is where you clone your object. PerlIO ALWAYS calls this method to make sure it has its own private encoding object. =item -E<gt>renewed Predefined As: sub renewed { $_[0]->{renewed} || 0 } Tells whether the object is renewed (and how many times). Some modules emit C<Use of uninitialized value in null operation> warning unless the value is numeric so return 0 for false. =item -E<gt>perlio_ok() Predefined As: sub perlio_ok { return eval { require PerlIO::encoding } ? 1 : 0; } If your encoding does not support PerlIO for some reasons, just; sub perlio_ok { 0 } =item -E<gt>needs_lines() Predefined As: sub needs_lines { 0 }; If your encoding can work with PerlIO but needs line buffering, you MUST define this method so it returns true. 7bit ISO-2022 encodings are one example that needs this. When this method is missing, false is assumed. =back =head2 Example: Encode::ROT13 package Encode::ROT13; use strict; use parent qw(Encode::Encoding); __PACKAGE__->Define('rot13'); sub encode($$;$){ my ($obj, $str, $chk) = @_; $str =~ tr/A-Za-z/N-ZA-Mn-za-m/; $_[1] = '' if $chk; # this is what in-place edit means return $str; } # Jr pna or ynml yvxr guvf; *decode = \&encode; 1; =head1 Why the heck Encode API is different? It should be noted that the I<$check> behaviour is different from the outer public API. The logic is that the "unchecked" case is useful when the encoding is part of a stream which may be reporting errors (e.g. STDERR). In such cases, it is desirable to get everything through somehow without causing additional errors which obscure the original one. Also, the encoding is best placed to know what the correct replacement character is, so if that is the desired behaviour then letting low level code do it is the most efficient. By contrast, if I<$check> is true, the scheme above allows the encoding to do as much as it can and tell the layer above how much that was. What is lacking at present is a mechanism to report what went wrong. The most likely interface will be an additional method call to the object, or perhaps (to avoid forcing per-stream objects on otherwise stateless encodings) an additional parameter. It is also highly desirable that encoding classes inherit from C<Encode::Encoding> as a base class. This allows that class to define additional behaviour for all encoding objects. package Encode::MyEncoding; use parent qw(Encode::Encoding); __PACKAGE__->Define(qw(myCanonical myAlias)); to create an object with C<< bless {Name => ...}, $class >>, and call define_encoding. They inherit their C<name> method from C<Encode::Encoding>. =head2 Compiled Encodings For the sake of speed and efficiency, most of the encodings are now supported via a I<compiled form>: XS modules generated from UCM files. Encode provides the enc2xs tool to achieve that. Please see L<enc2xs> for more details. =head1 SEE ALSO L<perlmod>, L<enc2xs> =begin future =over 4 =item Scheme 1 The fixup routine gets passed the remaining fragment of string being processed. It modifies it in place to remove bytes/characters it can understand and returns a string used to represent them. For example: sub fixup { my $ch = substr($_[0],0,1,''); return sprintf("\x{%02X}",ord($ch); } This scheme is close to how the underlying C code for Encode works, but gives the fixup routine very little context. =item Scheme 2 The fixup routine gets passed the original string, an index into it of the problem area, and the output string so far. It appends what it wants to the output string and returns a new index into the original string. For example: sub fixup { # my ($s,$i,$d) = @_; my $ch = substr($_[0],$_[1],1); $_[2] .= sprintf("\x{%02X}",ord($ch); return $_[1]+1; } This scheme gives maximal control to the fixup routine but is more complicated to code, and may require that the internals of Encode be tweaked to keep the original string intact. =item Other Schemes Hybrids of the above. Multiple return values rather than in-place modifications. Index into the string could be C<pos($str)> allowing C<s/\G...//>. =back =end future =cut PK Co�\��O1� � Config.pmnu �[��� # # Demand-load module list # package Encode::Config; our $VERSION = do { my @r = ( q$Revision: 2.5 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; use strict; use warnings; our %ExtModule = ( # Encode::Byte #iso-8859-1 is in Encode.pm itself 'iso-8859-2' => 'Encode::Byte', 'iso-8859-3' => 'Encode::Byte', 'iso-8859-4' => 'Encode::Byte', 'iso-8859-5' => 'Encode::Byte', 'iso-8859-6' => 'Encode::Byte', 'iso-8859-7' => 'Encode::Byte', 'iso-8859-8' => 'Encode::Byte', 'iso-8859-9' => 'Encode::Byte', 'iso-8859-10' => 'Encode::Byte', 'iso-8859-11' => 'Encode::Byte', 'iso-8859-13' => 'Encode::Byte', 'iso-8859-14' => 'Encode::Byte', 'iso-8859-15' => 'Encode::Byte', 'iso-8859-16' => 'Encode::Byte', 'koi8-f' => 'Encode::Byte', 'koi8-r' => 'Encode::Byte', 'koi8-u' => 'Encode::Byte', 'viscii' => 'Encode::Byte', 'cp424' => 'Encode::Byte', 'cp437' => 'Encode::Byte', 'cp737' => 'Encode::Byte', 'cp775' => 'Encode::Byte', 'cp850' => 'Encode::Byte', 'cp852' => 'Encode::Byte', 'cp855' => 'Encode::Byte', 'cp856' => 'Encode::Byte', 'cp857' => 'Encode::Byte', 'cp858' => 'Encode::Byte', 'cp860' => 'Encode::Byte', 'cp861' => 'Encode::Byte', 'cp862' => 'Encode::Byte', 'cp863' => 'Encode::Byte', 'cp864' => 'Encode::Byte', 'cp865' => 'Encode::Byte', 'cp866' => 'Encode::Byte', 'cp869' => 'Encode::Byte', 'cp874' => 'Encode::Byte', 'cp1006' => 'Encode::Byte', 'cp1250' => 'Encode::Byte', 'cp1251' => 'Encode::Byte', 'cp1252' => 'Encode::Byte', 'cp1253' => 'Encode::Byte', 'cp1254' => 'Encode::Byte', 'cp1255' => 'Encode::Byte', 'cp1256' => 'Encode::Byte', 'cp1257' => 'Encode::Byte', 'cp1258' => 'Encode::Byte', 'AdobeStandardEncoding' => 'Encode::Byte', 'MacArabic' => 'Encode::Byte', 'MacCentralEurRoman' => 'Encode::Byte', 'MacCroatian' => 'Encode::Byte', 'MacCyrillic' => 'Encode::Byte', 'MacFarsi' => 'Encode::Byte', 'MacGreek' => 'Encode::Byte', 'MacHebrew' => 'Encode::Byte', 'MacIcelandic' => 'Encode::Byte', 'MacRoman' => 'Encode::Byte', 'MacRomanian' => 'Encode::Byte', 'MacRumanian' => 'Encode::Byte', 'MacSami' => 'Encode::Byte', 'MacThai' => 'Encode::Byte', 'MacTurkish' => 'Encode::Byte', 'MacUkrainian' => 'Encode::Byte', 'nextstep' => 'Encode::Byte', 'hp-roman8' => 'Encode::Byte', #'gsm0338' => 'Encode::Byte', 'gsm0338' => 'Encode::GSM0338', # Encode::EBCDIC 'cp37' => 'Encode::EBCDIC', 'cp500' => 'Encode::EBCDIC', 'cp875' => 'Encode::EBCDIC', 'cp1026' => 'Encode::EBCDIC', 'cp1047' => 'Encode::EBCDIC', 'posix-bc' => 'Encode::EBCDIC', # Encode::Symbol 'dingbats' => 'Encode::Symbol', 'symbol' => 'Encode::Symbol', 'AdobeSymbol' => 'Encode::Symbol', 'AdobeZdingbat' => 'Encode::Symbol', 'MacDingbats' => 'Encode::Symbol', 'MacSymbol' => 'Encode::Symbol', # Encode::Unicode 'UCS-2BE' => 'Encode::Unicode', 'UCS-2LE' => 'Encode::Unicode', 'UTF-16' => 'Encode::Unicode', 'UTF-16BE' => 'Encode::Unicode', 'UTF-16LE' => 'Encode::Unicode', 'UTF-32' => 'Encode::Unicode', 'UTF-32BE' => 'Encode::Unicode', 'UTF-32LE' => 'Encode::Unicode', 'UTF-7' => 'Encode::Unicode::UTF7', ); unless ( ord("A") == 193 ) { %ExtModule = ( %ExtModule, 'euc-cn' => 'Encode::CN', 'gb12345-raw' => 'Encode::CN', 'gb2312-raw' => 'Encode::CN', 'hz' => 'Encode::CN', 'iso-ir-165' => 'Encode::CN', 'cp936' => 'Encode::CN', 'MacChineseSimp' => 'Encode::CN', '7bit-jis' => 'Encode::JP', 'euc-jp' => 'Encode::JP', 'iso-2022-jp' => 'Encode::JP', 'iso-2022-jp-1' => 'Encode::JP', 'jis0201-raw' => 'Encode::JP', 'jis0208-raw' => 'Encode::JP', 'jis0212-raw' => 'Encode::JP', 'cp932' => 'Encode::JP', 'MacJapanese' => 'Encode::JP', 'shiftjis' => 'Encode::JP', 'euc-kr' => 'Encode::KR', 'iso-2022-kr' => 'Encode::KR', 'johab' => 'Encode::KR', 'ksc5601-raw' => 'Encode::KR', 'cp949' => 'Encode::KR', 'MacKorean' => 'Encode::KR', 'big5-eten' => 'Encode::TW', 'big5-hkscs' => 'Encode::TW', 'cp950' => 'Encode::TW', 'MacChineseTrad' => 'Encode::TW', #'big5plus' => 'Encode::HanExtra', #'euc-tw' => 'Encode::HanExtra', #'gb18030' => 'Encode::HanExtra', 'MIME-Header' => 'Encode::MIME::Header', 'MIME-B' => 'Encode::MIME::Header', 'MIME-Q' => 'Encode::MIME::Header', 'MIME-Header-ISO_2022_JP' => 'Encode::MIME::Header::ISO_2022_JP', ); } # # Why not export ? to keep ConfigLocal Happy! # while ( my ( $enc, $mod ) = each %ExtModule ) { $Encode::ExtModule{$enc} = $mod; } 1; __END__ =head1 NAME Encode::Config -- internally used by Encode =cut PK Co�\�^0 0 Makefile_PL.e2xnu �[��� # # This file is auto-generated by: # enc2xs version $_Version_ # $_Now_ # use 5.7.2; use strict; use ExtUtils::MakeMaker; use Config; # Please edit the following to the taste! my $name = '$_Name_'; my %tables = ( $_Name__t => [ $_TableFiles_ ], ); #### DO NOT EDIT BEYOND THIS POINT! require File::Spec; my ($enc2xs, $encode_h) = (); my @path_ext = (''); @path_ext = split(';', $ENV{PATHEXT}) if $^O eq 'MSWin32'; PATHLOOP: for my $d (@Config{qw/bin sitebin vendorbin/}, (split /$Config{path_sep}/o, $ENV{PATH})){ for my $f (qw/enc2xs enc2xs5.7.3/){ my $path = File::Spec->catfile($d, $f); for my $ext (@path_ext) { my $bin = "$path$ext"; -r "$bin" and $enc2xs = $bin and last PATHLOOP; } } } $enc2xs or die "enc2xs not found!"; print "enc2xs is $enc2xs\n"; my %encode_h = (); for my $d (@INC){ my $dir = File::Spec->catfile($d, "Encode"); my $file = File::Spec->catfile($dir, "encode.h"); -f $file and $encode_h{$dir} = -M $file; } %encode_h or die "encode.h not found!"; # find the latest one ($encode_h) = sort {$encode_h{$b} <=> $encode_h{$a}} keys %encode_h; print "encode.h is at $encode_h\n"; WriteMakefile( INC => "-I$encode_h", #### END_OF_HEADER -- DO NOT EDIT THIS LINE BY HAND! #### NAME => 'Encode::'.$name, VERSION_FROM => "$name.pm", OBJECT => '$(O_FILES)', 'dist' => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', DIST_DEFAULT => 'all tardist', }, MAN3PODS => {}, PREREQ_PM => { 'Encode' => "1.41", }, # OS 390 winges about line numbers > 64K ??? XSOPT => '-nolinenumbers', ); package MY; sub post_initialize { my ($self) = @_; my %o; my $x = $self->{'OBJ_EXT'}; # Add the table O_FILES foreach my $e (keys %tables) { $o{$e.$x} = 1; } $o{"$name$x"} = 1; $self->{'O_FILES'} = [sort keys %o]; my @files = ("$name.xs"); $self->{'C'} = ["$name.c"]; # The next two lines to make MacPerl Happy -- dankogai via pudge $self->{SOURCE} .= " $name.c" if $^O eq 'MacOS' && $self->{SOURCE} !~ /\b$name\.c\b/; # $self->{'H'} = [$self->catfile($self->updir,'encode.h')]; my %xs; foreach my $table (sort keys %tables) { push (@{$self->{'C'}},"$table.c"); # Do NOT add $table.h etc. to H_FILES unless we own up as to how they # get built. foreach my $ext (qw($(OBJ_EXT) .c .h .exh .fnm)) { push (@files,$table.$ext); } } $self->{'XS'} = { "$name.xs" => "$name.c" }; $self->{'clean'}{'FILES'} .= join(' ',@files); open(XS,">$name.xs") || die "Cannot open $name.xs:$!"; print XS <<'END'; #include <EXTERN.h> #include <perl.h> #include <XSUB.h> #include "encode.h" END foreach my $table (sort keys %tables) { print XS qq[#include "${table}.h"\n]; } print XS <<"END"; static void Encode_XSEncoding(pTHX_ encode_t *enc) { dSP; HV *stash = gv_stashpv("Encode::XS", TRUE); SV *iv = newSViv(PTR2IV(enc)); SV *sv = sv_bless(newRV_noinc(iv),stash); int i = 0; /* with the SvLEN() == 0 hack, PVX won't be freed. We cast away name's constness, in the hope that perl won't mess with it. */ assert(SvTYPE(iv) >= SVt_PV); assert(SvLEN(iv) == 0); SvFLAGS(iv) |= SVp_POK; SvPVX(iv) = (char*) enc->name[0]; PUSHMARK(sp); XPUSHs(sv); while (enc->name[i]) { const char *name = enc->name[i++]; XPUSHs(sv_2mortal(newSVpvn(name,strlen(name)))); } PUTBACK; call_pv("Encode::define_encoding",G_DISCARD); SvREFCNT_dec(sv); } MODULE = Encode::$name PACKAGE = Encode::$name PROTOTYPES: DISABLE BOOT: { END foreach my $table (sort keys %tables) { print XS qq[#include "${table}.exh"\n]; } print XS "}\n"; close(XS); return "# Built $name.xs\n\n"; } sub postamble { my $self = shift; my $dir = "."; # $self->catdir('Encode'); my $str = "# $name\$(OBJ_EXT) depends on .h and .exh files not .c files - but all written by enc2xs\n"; $str .= "$name.c : $name.xs "; foreach my $table (sort keys %tables) { $str .= " $table.c"; } $str .= "\n\n"; $str .= "$name\$(OBJ_EXT) : $name.c\n\n"; foreach my $table (sort keys %tables) { my $numlines = 1; my $lengthsofar = length($str); my $continuator = ''; $str .= "$table.c : Makefile.PL"; foreach my $file (@{$tables{$table}}) { $str .= $continuator.' '.$self->catfile($dir,$file); if ( length($str)-$lengthsofar > 128*$numlines ) { $continuator .= " \\\n\t"; $numlines++; } else { $continuator = ''; } } my $plib = $self->{PERL_CORE} ? '"-I$(PERL_LIB)"' : ''; my $ucopts = '-"Q"'; $str .= qq{\n\t\$(PERL) $plib $enc2xs $ucopts -o \$\@ -f $table.fnm\n\n}; open (FILELIST, ">$table.fnm") || die "Could not open $table.fnm: $!"; foreach my $file (@{$tables{$table}}) { print FILELIST $self->catfile($dir,$file) . "\n"; } close(FILELIST); } return $str; } PK Co�\Vzr�~ ~ Byte.pmnu �[��� package Encode::Byte; use strict; use warnings; use Encode; our $VERSION = do { my @r = ( q$Revision: 2.4 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; use XSLoader; XSLoader::load( __PACKAGE__, $VERSION ); 1; __END__ =head1 NAME Encode::Byte - Single Byte Encodings =head1 SYNOPSIS use Encode qw/encode decode/; $greek = encode("iso-8859-7", $utf8); # loads Encode::Byte implicitly $utf8 = decode("iso-8859-7", $greek); # ditto =head1 ABSTRACT This module implements various single byte encodings. For most cases it uses \x80-\xff (upper half) to map non-ASCII characters. Encodings supported are as follows. Canonical Alias Description -------------------------------------------------------------------- # ISO 8859 series (iso-8859-1 is in built-in) iso-8859-2 latin2 [ISO] iso-8859-3 latin3 [ISO] iso-8859-4 latin4 [ISO] iso-8859-5 [ISO] iso-8859-6 [ISO] iso-8859-7 [ISO] iso-8859-8 [ISO] iso-8859-9 latin5 [ISO] iso-8859-10 latin6 [ISO] iso-8859-11 (iso-8859-12 is nonexistent) iso-8859-13 latin7 [ISO] iso-8859-14 latin8 [ISO] iso-8859-15 latin9 [ISO] iso-8859-16 latin10 [ISO] # Cyrillic koi8-f koi8-r cp878 [RFC1489] koi8-u [RFC2319] # Vietnamese viscii # all cp* are also available as ibm-*, ms-*, and windows-* # also see L<http://msdn.microsoft.com/en-us/library/aa752010%28VS.85%29.aspx> cp424 cp437 cp737 cp775 cp850 cp852 cp855 cp856 cp857 cp860 cp861 cp862 cp863 cp864 cp865 cp866 cp869 cp874 cp1006 cp1250 WinLatin2 cp1251 WinCyrillic cp1252 WinLatin1 cp1253 WinGreek cp1254 WinTurkish cp1255 WinHebrew cp1256 WinArabic cp1257 WinBaltic cp1258 WinVietnamese # Macintosh # Also see L<http://developer.apple.com/technotes/tn/tn1150.html> MacArabic MacCentralEurRoman MacCroatian MacCyrillic MacFarsi MacGreek MacHebrew MacIcelandic MacRoman MacRomanian MacRumanian MacSami MacThai MacTurkish MacUkrainian # More vendor encodings AdobeStandardEncoding nextstep hp-roman8 =head1 DESCRIPTION To find how to use this module in detail, see L<Encode>. =head1 SEE ALSO L<Encode> =cut PK Co�\�hHa a EBCDIC.pmnu �[��� package Encode::EBCDIC; use strict; use warnings; use Encode; our $VERSION = do { my @r = ( q$Revision: 2.2 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; use XSLoader; XSLoader::load( __PACKAGE__, $VERSION ); 1; __END__ =head1 NAME Encode::EBCDIC - EBCDIC Encodings =head1 SYNOPSIS use Encode qw/encode decode/; $posix_bc = encode("posix-bc", $utf8); # loads Encode::EBCDIC implicitly $utf8 = decode("", $posix_bc); # ditto =head1 ABSTRACT This module implements various EBCDIC-Based encodings. Encodings supported are as follows. Canonical Alias Description -------------------------------------------------------------------- cp37 cp500 cp875 cp1026 cp1047 posix-bc =head1 DESCRIPTION To find how to use this module in detail, see L<Encode>. =head1 SEE ALSO L<Encode>, L<perlebcdic> =cut PK Co�\0�vi� � KR.pmnu �[��� package Encode::KR; BEGIN { if ( ord("A") == 193 ) { die "Encode::KR not supported on EBCDIC\n"; } } use strict; use warnings; use Encode; our $VERSION = do { my @r = ( q$Revision: 2.3 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; use XSLoader; XSLoader::load( __PACKAGE__, $VERSION ); use Encode::KR::2022_KR; 1; __END__ =head1 NAME Encode::KR - Korean Encodings =head1 SYNOPSIS use Encode qw/encode decode/; $euc_kr = encode("euc-kr", $utf8); # loads Encode::KR implicitly $utf8 = decode("euc-kr", $euc_kr); # ditto =head1 DESCRIPTION This module implements Korean charset encodings. Encodings supported are as follows. Canonical Alias Description -------------------------------------------------------------------- euc-kr /\beuc.*kr$/i EUC (Extended Unix Character) /\bkr.*euc$/i ksc5601-raw Korean standard code set (as is) cp949 /(?:x-)?uhc$/i /(?:x-)?windows-949$/i /\bks_c_5601-1987$/i Code Page 949 (EUC-KR + 8,822 (additional Hangul syllables) MacKorean EUC-KR + Apple Vendor Mappings johab JOHAB A supplementary encoding defined in Annex 3 of KS X 1001:1998 iso-2022-kr iso-2022-kr [RFC1557] -------------------------------------------------------------------- To find how to use this module in detail, see L<Encode>. =head1 BUGS When you see C<charset=ks_c_5601-1987> on mails and web pages, they really mean "cp949" encodings. To fix that, the following aliases are set; qr/(?:x-)?uhc$/i => '"cp949"' qr/(?:x-)?windows-949$/i => '"cp949"' qr/ks_c_5601-1987$/i => '"cp949"' The ASCII region (0x00-0x7f) is preserved for all encodings, even though this conflicts with mappings by the Unicode Consortium. =head1 SEE ALSO L<Encode> =cut PK Co�\ >���"