#----------------------------------------------------------------- # decode.pl # # àÂÒÎÐ: íÈÔÎÍÒΠåÂÃÅÍÈÉ # ÈÑÏÐÀÂËÅÍÎ # # ïÐÎÖÅÄÓÐÛ ÄËß ÓÃÀÄÛÂÀÍÈß ÊÈÐÈËËÈ×ÅÑÊÎÉ ÊÎÄÈÐÎÂÊÈ wEB-ÊËÈÅÍÒÀ # È ÏÅÐÅÊÎÄÈÐÎÂÀÍÈß HTML-ÄÎÊÓÌÅÍÒÀ  ÊÎÄÈÐÎÂÊÓ ÊËÈÅÍÒÀ #------------------------------------------------------------------ sub GuessHTTP_ACCEPT{ local($string); $string=$ENV{HTTP_ACCEPT}; if ( $string=~ /koi/i ){ $GuessAnswer='KOI'; } elsif ( $string=~ /volapuk/i ){ $GuessAnswer='volapuk'; } elsif ( $string=~ /cp1251|win/i ){ $GuessAnswer='windows'; } elsif ( $string=~ /cp866|alt/i ){ $GuessAnswer='alt'; } elsif ( $string=~ /iso-8859-5/i ){ $GuessAnswer='iso_8859_5'; } else return 0; return 1 ; } # end GuessHTTP_ACCEPT sub GuessHTTP_USER_AGENT{ local($string); $string=$ENV{HTTP_USER_AGENT}; if ($string=~ /Lynx/) { $GuessAnswer='KOI'; } elsif ($string=~ /X/) { $GuessAnswer='KOI'; } elsif ($string=~ /Win/i) { $GuessAnswer='windows'; } else return 0; return 1 } # sub GuessHTTP_USER_AGENT sub CharsetGuess { if ( &GuessHTTP_ACCEPT ) { return 1 }; &GuessHTTP_USER_AGENT ) } sub ChooseCharset{ if (@_) { local (*in) = @_; } print <

Can't Guess Your Cyrillic Charset


EOT } # sub ChooseCharset sub Guess_Decode_Send{ if (@_) { local (*in) = @_; } if (&CharsetGuess) { if ($GuessAnswer eq 'KOI') {print @in} else{ local($decodeprog)="koi2${GuessAnswer}"; open(PIPE,"|/usr/local/www/cgi-bin/tools/decoders/$decodeprog"); print PIPE @in; close(PIPE); } } else { &ChooseCharset(*in) }; } # sub Guess_Decode_Send 1;