use Encode; # Traditional Chinese $euc_tw = encode("euc-tw", $utf8); # loads Encode::HanExtra implicitly $utf8 = decode("euc-tw", $euc_tw); # ditto # Simplified Chinese $gb18030 = encode("gb18030", $utf8); # loads Encode::HanExtra implicitly $utf8 = decode("gb18030", $gb18030); # ditto
However, the numbers of Chinese encodings are staggering, and a complete coverage will easily increase the size of perl distribution by several megabytes; hence, this CPAN module tries to provide the rest of them.
If you are using Perl 5.8 or later, Encode::CN and Encode::TW will automatically load the extra encodings for you, so there's no need to explicitly write "use Encode::HanExtra" if you are using one of them already.
Canonical Alias Description ----------------------------------------------------------------------------- big5-1984 /\b(tca-)?big5-?(19)?84$/i TCA's original Big5-1984 big5-2003 /\b(cmex-)?big5-?(20)?03$/i Big5-2003 (national standard) big5ext /\b(cmex-)?big5-?e(xt)?$/i CMEX's Big5e Extension big5plus /\b(cmex-)?big5-?p(lus)?$/i CMEX's Big5+ Extension /\b(cmex-)?big5\+$/i cccii /\b(ccag-)?cccii$/i Chinese Character Code for Information Interchange cns11643-1 /\bCNS[-_ ]?11643[-_]1$/i Taiwan's CNS map, plane 1 cns11643-2 /\bCNS[-_ ]?11643[-_]2$/i Taiwan's CNS map, plane 2 cns11643-3 /\bCNS[-_ ]?11643[-_]3$/i Taiwan's CNS map, plane 3 cns11643-4 /\bCNS[-_ ]?11643[-_]4$/i Taiwan's CNS map, plane 4 cns11643-5 /\bCNS[-_ ]?11643[-_]5$/i Taiwan's CNS map, plane 5 cns11643-6 /\bCNS[-_ ]?11643[-_]6$/i Taiwan's CNS map, plane 6 cns11643-7 /\bCNS[-_ ]?11643[-_]7$/i Taiwan's CNS map, plane 7 cns11643-f /\bCNS[-_ ]?11643[-_]f$/i Taiwan's CNS map, plane F euc-tw /\beuc.*tw$/i EUC (Extended Unix Character) /\btw.*euc$/i gb18030 /\bGB[-_ ]?18030$/i GBK with Traditional Characters unisys /\bunisys$/i Unisys Traditional Chinese unisys-sosi1 Unisys SOSI1 transport encoding unisys-sosi2 Unisys SOSI2 transport encoding
Detailed descriptions are as follows:
Please send me suggestions if you want to see more encoding added, such as "BIG5-GCCS" (superseded by "BIG5-HKSCS"). Other suggestions are welcome, too.
Map for "BIG5PLUS" is generated from the BIG52UCS.TXT file, courtesy of CMEX Taiwan (Chinese Microcomputer Extended Foundation, <http://www.cmex.org.tw/>).
Map for "BIG5-1984" is supplied by imacat.
Map for "CCCII" is supplied by the Koha Taiwan project.
This software is released under the MIT license cited below.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.