cnpait/detect_encoding

Cyrillic text encoding detection class

dev-master 2020-01-10 14:35 UTC

This package is auto-updated.

Last update: 2024-04-10 23:33:29 UTC


README

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": {
    "ivanmtw/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/