PHP Classes

PHP Detect Encoding: Detect the encoding of text from a file or string

Recommend this page to a friend!
  Info   View files View files (1)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 54%Total: 702 All time: 4,676 This week: 170Up
Version License PHP version Categories
detect-encoding 1BSD License5PHP 5, Text processing


This class can detect the encoding of text from a file or string.

It can read the text from a file or a given string and detect different types of the UTF character encoding.

Currently it can distinguish UTF-8, UTF-16, UTF-32 little or big endian encodings. It returns false for unknown encodings.

Innovation Award
PHP Programming Innovation award nominee
January 2014
Number 6
Sometimes it is necessary to process text in a way that depends on which character encoding is used.

However, in some circumstances it may not be possible to know for sure what is the encoding of the text.

This class can guess the character encoding by analyzing part of the text.

Manuel Lemos
Picture of marcelo entraigas
Name: marcelo entraigas <contact>
Classes: 7 packages by
Country: Argentina Argentina
Age: 46
All time rank: 5496 in Argentina Argentina
Week rank: 358 Up4 in Argentina Argentina Up
Innovation award
Innovation award
Nominee: 1x

  Files folder image Files  
File Role Description
Plain text file DetectEncoding.php Class Main php file

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:4,676
This week:170Up
 User Ratings  
 All time