☻ 唐鳳 ☺ > Convert-EastAsianWidth-1.02 > Convert::EastAsianWidth

Download:
Convert-EastAsianWidth-1.02.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Module Version: 1.02   Source  

NAME ^

Convert::EastAsianWidth - Convert between full/half-width ASCII characters

VERSION ^

This document describes version 1.01 of Convert:EastAsianWidth, released November 7, 2010.

SYNOPSIS ^

    # Exports to_fullwidth() and to_halfwidth() by default
    use Convert::EastAsianWidth;

    my $u = to_fullwidth('ABC');            # Full-width variant of 'ABC'
    my $b = to_fullwidth('ABC', 'big5');    # Ditto, but in big5 encoding
    my $x = to_halfwidth($u);               # Gets back 'ABC'
    my $y = to_halfwidth($b, 'big5');       # Same as above

DESCRIPTION ^

This module efficiently convert between full- and half-width ASCII characters, including alphanumerics and punctuations.

The first argument is the string to be converted; the second one represents the input and encodings. If omitted, both are assumed to be Unicode strings.

CAVEATS ^

This module does not handle conversion of full/half width katakana, which is a slightly more complicated problem because of the need to incorporate diacritics.

Many thanks to BKB for the disclaimer above and for suggesting a more efficient conversion algorithm based on tr///.

SEE ALSO ^

Encode

AUTHORS ^

唐鳳 <cpan@audreyt.org>

CC0 1.0 Universal ^

To the extent possible under law, 唐鳳 has waived all copyright and related or neighboring rights to Convert-EastAsianWidth.

This work is published from Taiwan.

http://creativecommons.org/publicdomain/zero/1.0

syntax highlighting: