NAME

cyrillic - Library for fast and easy cyrillic text manipulation

SYNOPSIS

use cyrillic qw/866 win2dos convert locase upcase detect/;

print convert( 866, 1251, $str );
print convert( 'dos','win', \$str );
print win2dos $str;

DESCRIPTION

If first import parameter is number of codepage then locale switched to they codepage. Specialisation (like 'win2dos') call faster then 'convert'. Easy adding new charset. For they need only add charset string.

FUNCTIONS

At importing list might be listed named convertors. For Ex.:

use cyrillic qw/dos2win win2koi mac2dos ibm2dos/;
convert SRC_CP, DST_CP, [VAR]

Convert VAR from SRC_CP codepage to DST_CP codepage and returns converted string. VAR may be SCALAR or REF to SCALAR. If VAR is REF to SCALAR then SCALAR will be converted. If VAR is ommited then $_ operated. If function called to void context and VAR is not REF then result placed to $_.

upcase CODEPAGE, [VAR]

Convert VAR to uppercase using CODEPAGE table and returns converted string. VAR may be SCALAR or REF to SCALAR. If VAR is REF to SCALAR then SCALAR will be converted. If VAR is ommited then $_ operated. If function called to void context and VAR is not REF then result placed to $_.

locase CODEPAGE, [VAR]

Convert VAR to lowercase using CODEPAGE table and returns converted string. VAR may be SCALAR or REF to SCALAR. If VAR is REF to SCALAR then SCALAR will be converted. If VAR is ommited then $_ operated. If function called to void context and VAR is not REF then result placed to $_.

detect ARRAY

Detect charset of data in ARRAY and returns name of charset. If charset name not detected then returns 'eng';

EXAMPLES

use cyrillic qw/convert locase upcase detect dos2win win2dos/;

$\ = "\n";
$_ = "\x8F\xE0\xA8\xA2\xA5\xE2 \xF0\xA6\x88\xAA\x88!";

print; upcase 866;
print; dos2win;
print; win2dos;
print; locase 866;
print;
print detect $_;


# EQVIVALENT CALLS:

dos2win( $str );
$_ = dos2win( $str );

dos2win( \$str );
$str = dos2win( $str );

dos2win();
dos2win( \$_ );
$_ = dos2win( $_ );


# FOR EASY SWITCH LOCALE CODEPAGE

use cyrillic qw/866/;

use locale;
$str =~ /a-ï/;

no locale;
$str =~ /a-ï/;

AUTHOR

Albert MICHEEV <Albert@f80.n5049.z2.fidonet.org>

COPYRIGHT

Copyright (C) 2000, Albert MICHEEV

This module is free software; you can redistribute it or modify it under the same terms as Perl itself.

3 POD Errors

The following errors were encountered while parsing the POD:

Around line 28:

'=item' outside of any '=over'

Around line 57:

You forgot a '=back' before '=head1'

Around line 90:

Non-ASCII character seen before =encoding in '/a-ï/;'. Assuming CP1252