Unicode::Lite - Library for easy charset convertion
use Unicode::Lite qw/convert convertor/; print convert( 'ibm866', 'unicode', "hello world!" ); local *ibm2uni = convertor( 'ibm866', 'unicode' ); print ibm2uni( "hello world!" ); my $ibm2uni = convertor( 'ibm866', 'unicode' ); print &$ibm2uni( "hello world!" );
This module includes string converting function from one and to another charset. Requires installed Unicode::String and Unicode::Map packages.
Supported unicode charsets: unicode, utf16, ucs2, utf8, utf7, ucs4, latin1, uchr, uhex.
Supported single-byte charsets: all installed maps in Unicode::Map package.
Convert VAR from SRC_CP codepage to DST_CP codepage and returns converted string.
Creates convertor function and returns reference to her, for further fast direct call.
The following rules are correct for converting functions: VAR may be SCALAR or REF to SCALAR. If VAR is REF to SCALAR then SCALAR will be converted. If VAR is omitted, uses $_. If function called to void context and VAR is not REF then result placed to $_.
local *ibm2uni = convertor( 'ibm866', 'unicode' ); # EQVIVALENT CALLS: ibm2uni( $str ); # called to void context -> result placed to $_ $_ = ibm2uni( $str ); ibm2uni( \$str ); # called with REF to string -> direct converting $str = ibm2uni( $str ); ibm2uni(); # with omitted param called -> $_ converted ibm2uni( \$_ ); $_ = ibm2uni( $_ );
Albert MICHEEV <Albert@f80.n5049.z2.fidonet.org>
Copyright (C) 2000, Albert MICHEEV
This module is free software; you can redistribute it or modify it under the same terms as Perl itself.
The latest version of this library is likely to be available from:
http://www.perl.com/CPAN
Unicode::String, Unicode::Map.
To install Unicode::Lite, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Unicode::Lite
CPAN shell
perl -MCPAN -e shell install Unicode::Lite
For more information on module installation, please visit the detailed CPAN module installation guide.