private function identifyText($text) { // TODO Replace this with an algorithm to choose the encoding which will // encode the farthest into the string, to minimise code page changes. $char = mb_substr($text, 0, 1, self::INPUT_ENCODING); if (!isset($this->available[$char])) { /* Character not available anywhere */ return false; } foreach ($this->available[$char] as $encodingNo => $true) { /* Return first code-page where it is available */ return $encodingNo; } return false; }