1package Encode::HanExtra; 2use 5.007003; 3 4our $VERSION = '0.23'; 5use Encode; 6use XSLoader; 7XSLoader::load(__PACKAGE__, $VERSION); 8 9Encode::define_alias( qr/\b(?:tca-)?big5-?(?:19)?84?$/i => '"big5-1984"' ); 10Encode::define_alias( qr/\b(?:cmex-)?big5-?(?:20)?03?$/i => '"big5-2003"' ); 11Encode::define_alias( qr/\b(?:cmex-)?big5-?e(?:xt)?$/i => '"big5ext"' ); 12Encode::define_alias( qr/\b(?:cmex-)?big5-?p(?:lus)?$/i => '"big5plus"' ); 13Encode::define_alias( qr/\b(?:cmex-)?big5\+$/i => '"big5plus"' ); 14Encode::define_alias( qr/\b(?:ccag-)?cccii$/i => '"cccii"' ); 15Encode::define_alias( qr/\bunisys$/i => '"unisys"' ); 16Encode::define_alias( qr/\beuc.*tw$/i => '"euc-tw"' ); 17Encode::define_alias( qr/\btw.*euc$/i => '"euc-tw"' ); 18Encode::define_alias( qr/\bGB[-_ ]?18030/i => '"gb18030"' ); 19Encode::define_alias( qr/\bCNS[-_ ]?11643[-_]1/i => '"cns11643-1"' ); 20Encode::define_alias( qr/\bCNS[-_ ]?11643[-_]2/i => '"cns11643-2"' ); 21Encode::define_alias( qr/\bCNS[-_ ]?11643[-_]3/i => '"cns11643-3"' ); 22Encode::define_alias( qr/\bCNS[-_ ]?11643[-_]4/i => '"cns11643-4"' ); 23Encode::define_alias( qr/\bCNS[-_ ]?11643[-_]5/i => '"cns11643-5"' ); 24Encode::define_alias( qr/\bCNS[-_ ]?11643[-_]6/i => '"cns11643-6"' ); 25Encode::define_alias( qr/\bCNS[-_ ]?11643[-_]7/i => '"cns11643-7"' ); 26Encode::define_alias( qr/\bCNS[-_ ]?11643[-_]f/i => '"cns11643-f"' ); 27 281; 29 30__END__ 31 32=head1 NAME 33 34Encode::HanExtra - Extra sets of Chinese encodings 35 36=head1 VERSION 37 38This document describes version 0.23 of Encode::HanExtra, released 39November 10, 2007. 40 41=head1 SYNOPSIS 42 43 use Encode; 44 45 # Traditional Chinese 46 $euc_tw = encode("euc-tw", $utf8); # loads Encode::HanExtra implicitly 47 $utf8 = decode("euc-tw", $euc_tw); # ditto 48 49 # Simplified Chinese 50 $gb18030 = encode("gb18030", $utf8); # loads Encode::HanExtra implicitly 51 $utf8 = decode("gb18030", $gb18030); # ditto 52 53=head1 DESCRIPTION 54 55Perl 5.7.3 and later ships with an adequate set of Chinese encodings, 56including the commonly used C<CP950>, C<CP936> (also known as C<GBK>), 57C<Big5> (alias for C<Big5-Eten>), C<Big5-HKSCS>, C<EUC-CN>, C<HZ>, and 58C<ISO-IR-165>. 59 60However, the numbers of Chinese encodings are staggering, and a complete 61coverage will easily increase the size of perl distribution by several 62megabytes; hence, this CPAN module tries to provide the rest of them. 63 64If you are using Perl 5.8 or later, L<Encode::CN> and L<Encode::TW> will 65automatically load the extra encodings for you, so there's no need to 66explicitly write C<use Encode::HanExtra> if you are using one of them 67already. 68 69=head1 ENCODINGS 70 71This version includes the following encoding tables: 72 73 Canonical Alias Description 74 ----------------------------------------------------------------------------- 75 big5-1984 /\b(tca-)?big5-?(19)?84$/i TCA's original Big5-1984 76 big5-2003 /\b(cmex-)?big5-?(20)?03$/i Big5-2003 (national standard) 77 big5ext /\b(cmex-)?big5-?e(xt)?$/i CMEX's Big5e Extension 78 big5plus /\b(cmex-)?big5-?p(lus)?$/i CMEX's Big5+ Extension 79 /\b(cmex-)?big5\+$/i 80 cccii /\b(ccag-)?cccii$/i Chinese Character Code for 81 Information Interchange 82 cns11643-1 /\bCNS[-_ ]?11643[-_]1$/i Taiwan's CNS map, plane 1 83 cns11643-2 /\bCNS[-_ ]?11643[-_]2$/i Taiwan's CNS map, plane 2 84 cns11643-3 /\bCNS[-_ ]?11643[-_]3$/i Taiwan's CNS map, plane 3 85 cns11643-4 /\bCNS[-_ ]?11643[-_]4$/i Taiwan's CNS map, plane 4 86 cns11643-5 /\bCNS[-_ ]?11643[-_]5$/i Taiwan's CNS map, plane 5 87 cns11643-6 /\bCNS[-_ ]?11643[-_]6$/i Taiwan's CNS map, plane 6 88 cns11643-7 /\bCNS[-_ ]?11643[-_]7$/i Taiwan's CNS map, plane 7 89 cns11643-f /\bCNS[-_ ]?11643[-_]f$/i Taiwan's CNS map, plane F 90 euc-tw /\beuc.*tw$/i EUC (Extended Unix Character) 91 /\btw.*euc$/i 92 gb18030 /\bGB[-_ ]?18030$/i GBK with Traditional Characters 93 unisys /\bunisys$/i Unisys Traditional Chinese 94 unisys-sosi1 Unisys SOSI1 transport encoding 95 unisys-sosi2 Unisys SOSI2 transport encoding 96 97Detailed descriptions are as follows: 98 99=over 4 100 101=item BIG5-1984 102 103This is the original Big5 encoding made by TCA Taiwan. 104 105=item BIG5-2003 106 107This revised encoding is now national standard, as an appendix of CNS11643. 108 109=item BIG5PLUS 110 111This encoding, while not heavily used, is an attempt to bring all Taiwan's 112conflicting internal-use encodings together, and fit it as an extension to 113the widely-deployed Big5 range, by CMEX Taiwan. 114 115=item BIG5EXT 116 117The CMEX's second (and less ambitious) try at unifying the most commonly 118used characters not covered by Big5, while not polluting out of the 94x94 119arragement like BIG5PLUS did. 120 121=item CCCII 122 123The earliest (and most sophisticated) Traditional Chinese encoding, with a 124three-byte raw character map, made in 1980 by the Chinese Character Analysis 125Group (CCAG), used mostly in library systems. 126 127=item EUC-TW 128 129The EUC transport version of C<CNS11643> (planes 1-7), the comprehensive 130character set used by the Taiwan government. 131 132=item CNS11643-* 133 134The raw character map extracted from the Unihan database, including the 135plane F which wasn't included in C<EUC-TW>. 136 137=item GB18030 138 139An extension to GBK, this encoding lists most Han characters (both simplified 140and traditional), as well as some other encodings used by other peoples in 141China. 142 143=item UNISYS 144 145Unisys System's internal Chinese mapping. 146 147=back 148 149=head1 NOTES 150 151If you are looking for ways to transliterate between Simplified and 152Traditional Chinese, please take a look at L<Encode::HanConvert>. Note 153that the direct mapping via Unicode is lossy, and usually doesn't work 154at all. 155 156Please send me suggestions if you want to see more encoding added, such 157as C<BIG5-GCCS> (superseded by C<BIG5-HKSCS>). Other suggestions are welcome, 158too. 159 160=head1 SEE ALSO 161 162L<Encode>, L<Encode::HanConvert> 163 164=head1 ACKNOWLEDGEMENTS 165 166Some of the maps here are generated from GNU libiconv's test files, 167with kind permission from Bruno Haible. 168 169Map for C<BIG5PLUS> is generated from the F<BIG52UCS.TXT> file, 170courtesy of CMEX Taiwan (Chinese Microcomputer Extended Foundation, 171L<http://www.cmex.org.tw/>). 172 173Map for C<BIG5-1984> is supplied by imacat. 174 175Map for C<CCCII> is supplied by the Koha Taiwan project. 176 177=head1 AUTHORS 178 179Audrey Tang E<lt>audreyt@audreyt.orgE<gt> 180 181=head1 COPYRIGHT 182 183Copyright 2002-2007 by Audrey Tang E<lt>audreyt@audreyt.orgE<gt>. 184 185This software is released under the MIT license cited below. 186 187=head2 The "MIT" License 188 189Permission is hereby granted, free of charge, to any person obtaining a copy 190of this software and associated documentation files (the "Software"), to deal 191in the Software without restriction, including without limitation the rights 192to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 193copies of the Software, and to permit persons to whom the Software is 194furnished to do so, subject to the following conditions: 195 196The above copyright notice and this permission notice shall be included in 197all copies or substantial portions of the Software. 198 199THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 200OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 201FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 202THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 203LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 204FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 205DEALINGS IN THE SOFTWARE. 206 207=cut 208