home *** CD-ROM | disk | FTP | other *** search
- # ------------------------------------------------------------------------------
- # STRING ROUTINES LIBRARY by A.I.Studio / Igor Afanasyev
- # ------------------------------------------------------------------------------
-
- #-------------------------------------------------------------------------------
- sub int_initialize {
- #-------------------------------------------------------------------------------
- my $cp1251 = "αßΓπΣσ╕µτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ └┴┬├─┼¿╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀";
- my $cp866 = "áíóúñѱªº¿⌐¬½¼¡«»αßΓπΣσµτΦΘΩδ∞φε∩Çüéâäà≡åçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒ";
-
- my @cp1251 = split //,$cp1251;
- my @cp866 = split //,$cp866;
-
- for (my $i = 0; $i < $#cp866; $i++) {
- $cp866to1251{$cp866[$i]} = $cp1251[$i];
- }
- } # end sub
-
- #-------------------------------------------------------------------------------
- sub cp866to1251 {
- #-------------------------------------------------------------------------------
- @a = split //,$_[0];
-
- for (my $i = 0; $i < $#a; $i++) {
- if (exists $cp866to1251{$a[$i]}) {
- $a[$i] = $cp866to1251{$a[$i]};
- }
- }
- return join('',@a);
- } # end sub
-
- #-------------------------------------------------------------------------------
- sub ProcessDosResponse {
- #-------------------------------------------------------------------------------
- my $s = $_[0];
- $s = &cp866to1251($s); # converting Russian Dos 866 to Win1251 codepage
- $s =~ s/\r*\n/\n/g; # adjusting line breaks
- $s =~ s/[ \t]*\n[ \t]*/\n/g; # trimming lines
- $s =~ s/\r*\n/<BR>/g; # substituting line breaks to '<BR>' tags
- return $s;
- } # end sub
-
- # ------------------------------------------------------------------------------
-
- &int_initialize;
-
- return 1; # true
-