Sawered / detect_encoding

Cyrillic text encoding detection class for php >=5.3

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cyrillic text encoding detection class

Detect utf-8, windows-1251, koi8-r, iso8859-5 cyrillic encoding

Installation with Composer

Declare detect_encoding as a dependency in your projects composer.json file:

{
  "require": {
    "cnpait/detect_encoding": "dev-master"
  }
}

Usage Example

    <?php

    use DetectCyrillic\Encoding;

    $text = 'Привет, как дела?';
    //require_once 'detect_encoding/classes/DetectCyrillic/Encoding.php';
    $Detector = new Encoding();
    $encoding = $Detector->detectMaxRelevant($text);

    ?>

Requirements

PHP 5.3 and up.

Класс для определения кодировки текста. Использует статистические методы, см. исходные статьи:

Код является оберткой, готовой к эксплуатации, на основе https://github.com/m00t/detect_encoding/

About

Cyrillic text encoding detection class for php >=5.3


Languages

Language:PHP 100.0%