/** * @param string $filePath * @return string */ public function convertFileToUtf($filePath) { $fileEncoding = $this->charsetDetector->detectForFilePath($filePath); $content = file_get_contents($filePath); if ($fileEncoding === Encoding::UTF_8) { return $content; } else { return $this->convertContentToUtf($content, $fileEncoding); } }
private function detectCharsetFromHtml($html, $charset_hint = null) { $charsetDetector = new CharsetDetector($html); return $charsetDetector->getCharset(); }