From eddeaca7e65e5b05833aec08434c000f36fe98e0 Mon Sep 17 00:00:00 2001 From: Andrew Rudenets <andrey.rudenets@gmail.com> Date: Wed, 28 Oct 2015 12:50:59 +0300 Subject: [PATCH] fix --- ~dev_rating/application/classes/FileParser.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/~dev_rating/application/classes/FileParser.php b/~dev_rating/application/classes/FileParser.php index 18df0d806..7f7c1d910 100644 --- a/~dev_rating/application/classes/FileParser.php +++ b/~dev_rating/application/classes/FileParser.php @@ -110,10 +110,10 @@ class FileParser public static function toUTF8($source_str) { // TODO: make it able to convert from any encoding to UTF-8 $enc = mb_detect_encoding($source_str, mb_list_encodings(), true); - if ($enc === false) - return $source_str; - else if ($enc !== "UTF-8") + if ($enc === "ISO-8859-1" || !$enc) return mb_convert_encoding($source_str, "utf-8", "windows-1251"); + else if ($enc !== "UTF-8") + return mb_convert_encoding($source_str, "utf-8", $enc); else return $source_str; } -- GitLab