Converts half-width katakana to their full-width counterparts

W

wing328hk

Hi,

Does anyone know if there is a function in Perl to convert half-width
katakana to their full-width
counterparts?

I have found that the conversion can be done as shown in
ftp://ftp.ora.com/pub/examples/nutshell/ujip/perl/unkana.pl, but that
example is 10 years ago and I'm wondering if there are some new ways to
do it?

Thanks,
Wing
 
G

Guest

(e-mail address removed) wrote:

: I have found that the conversion can be done as shown in
: ftp://ftp.ora.com/pub/examples/nutshell/ujip/perl/unkana.pl, but that
: example is 10 years ago and I'm wondering if there are some new ways to
: do it?

Not really except for the arrival of Unicode. The script still holds
valid in a central point: the conversion from two-char half-width kana
into one-char full-width kana. The ksth rows can be modified by a double-
dot (dakuten): ka+"=>ga, ke+"=>ge, ..., sa+"=>za, ... ta+"=>da, ... ho+"=>bo.
You need two (half-width) character cells for expressing one kana, yet
full-width kana all puts it (i.e. base character and diacritics) into
one character cell.

So, you simply add a Unicode table to the program. FW hiragana starts at
U+3042, katakana at U+30a2.

But, before I forget, you should have a look at Unicode::Japanese. It seems
to perform this action, too, but I didn't test it. Another one is Jcode, a
Japanese charset handler (also untested). There may be more, check CPAN with
keyword Japanese.

Oliver.
 
B

Brad Baxter

Hi,

Does anyone know if there is a function in Perl to convert half-width
katakana to their full-width
counterparts?

I have found that the conversion can be done as shown in
ftp://ftp.ora.com/pub/examples/nutshell/ujip/perl/unkana.pl, but that
example is 10 years ago and I'm wondering if there are some new ways to
do it?

Thanks,
Wing

Perhaps Unicode::Normalize?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top