Lingua::ZH::HanConvert 0.12 review
DownloadLingua::ZH::HanConvert is a Perl module to convert between Traditional and Simplified Chinese characters. SYNOPSIS #!perl -
|
|
Lingua::ZH::HanConvert is a Perl module to convert between Traditional and Simplified Chinese characters.
SYNOPSIS
#!perl -lw
use Lingua::ZH::HanConvert qw(simple trad);
use utf8;
my $t = "?œ‹"; # Traditional symbol for "country", unicode 22283
# or: my $t = v22283;
print simple($t); # Simplified "country", ?›? (unicode 22269)
$s = "?±?"; # Simplified symbol for "fish", unicode 40060
# or: $s = v40060;
print trad($s); # Traditional "fish", ?š (unicode 39970)
In the 1950's, the Chinese government simplified over 2000 Chinese characters. Taiwan and Hong Kong still use the traditional characters. The simplified characters are hard to read if you only know the traditional ones, and vice-versa. This module attempts to convert Chinese text between the two forms, using character-by-character transliteration.
Note that this module only handles text in the Unicode UTF-8 character set. If you need to convert between the Big5 and GB character sets, then please look at Text::IConv, or use the HanConvert Perl script which comes with this module.
simple takes a string, converts any traditional Chinese characters (such as 國, unicode U+570B, meaning "country") to the corresponding simplified characters (like 国, unicode U+56FD, also meaning "country"), and returns the result. Characters which are not traditional Chinese do not change.
trad does the reverse; it converts any simplified Chinese characters to the corresponding traditional characters. Characters which are not simplified Chinese do not change.
If a simplified character has two or more corresponding traditional characters, then it will be replaced by all of them, enclosed in square brackets. To use different characters instead of the square brackets, give them as the second and third arguments to trad. The same applies where a traditional character has two or more corresponding simplified forms, but this happens much more rarely.
Requirements:
Perl
Lingua::ZH::HanConvert 0.12 keywords