onnov/detect-encoding
Fast Cyrillic text encoding detector for PHP to replace unreliable mb_detect_encoding. Identifies Windows-1251, KOI8-R, ISO-8859-5 (optionally IBM866/MacCyrillic) using code page ranges, with high accuracy even on short strings and very large texts.
windows-1251 or koi8-r, reducing manual intervention and data corruption risks.Adopt when:
mb_detect_encoding fails to accurately identify encodings like windows-1251, koi8-r, or iso-8859-5.mb_detect_encoding’s reliability drops significantly for certain encodings.Look elsewhere if:
mb_detect_encoding in PHP 8.x+) meets your needs.For Executives:
*"This package resolves a critical technical gap in our ability to accurately process text from legacy systems and global markets. For example, misdetecting windows-1251 as UTF-8 could corrupt Cyrillic emails or documents, leading to customer dissatisfaction or compliance issues. By adopting this lightweight, MIT-licensed solution, we can:
For Engineering:
*"The onnov/detect-encoding package provides a drop-in replacement for mb_detect_encoding with 99.9%+ accuracy for Cyrillic and legacy encodings—critical for our [legacy migration/data pipeline/API]. Here’s why it’s a win:
windows-1251 (where mb_detect_encoding fails for short texts).mb_detect_encoding($text, 'UTF-8,WINDOWS-1251,...') with:
$detector = new \Onnov\DetectEncoding\EncodingDetector();
$encoding = $detector->getEncoding($text);
app/Services/EncodingDetector).For Product/Design: *"This package enables us to safely expand into markets where text encoding is a barrier (e.g., Russia, Ukraine). For example:
How can I help you explore Laravel packages today?