#----------------------------------------------------------------- # 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;