The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.


Lingua::DetectCharset - Routine for automatically detecting cyrillic charset.


use Lingua::DetectCharset;

$Charset = Lingua::DetectCharset::Detect ($Buffer);

The returned $Ecoding is either 'WIN' or 'KOI8'.


This package implements routine for detection charset of the given text snippet. Snippet may contain anything from few words to many kilobytes of text, and may have line breaks, English text and html tags embedded.

This routine is implemented using algorithm of statistical analysis of text, which was proved to be very efficient and showed around 99.98% acccuracy in tests.


John Neystadt <>


perl(1), Convert::Cyrillic(3).


Part of "WWW Cyrillic Encoding Suite" Get docs and newest version from

Copyright (c) 1997-98, John Neystadt <> You may install this script on your web site for free To obtain permision for redistribution or any other usage contact

Drop me a line if you deploy this script on your site.