From 3ee055c2154b122eb877e1be4135244c0cb5e5cd Mon Sep 17 00:00:00 2001 From: "m.korolev" Date: Fri, 8 Nov 2013 19:21:08 +0400 Subject: [PATCH] bugfix charset error from cli --- intaro.intarocrm/classes/general/ICMLLoader.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/intaro.intarocrm/classes/general/ICMLLoader.php b/intaro.intarocrm/classes/general/ICMLLoader.php index 2b91b439..103dc239 100644 --- a/intaro.intarocrm/classes/general/ICMLLoader.php +++ b/intaro.intarocrm/classes/general/ICMLLoader.php @@ -11,6 +11,7 @@ class ICMLLoader { public $propertiesProduct; public $application; public $encoding = 'utf-8'; + public $defaultCharset = null; protected $fp; protected $mainSection = 1000000; @@ -28,6 +29,8 @@ class ICMLLoader { $this->isLogged = true; + $this->defaultCharset = LANG_CHARSET; + $this->PrepareSettings(); @@ -80,7 +83,10 @@ class ICMLLoader { protected function PrepareValue($text) { - $newText = $this->application->ConvertCharset($text, LANG_CHARSET, $this->encoding); + if ($this->defaultCharset === "") + $this->defaultCharset = mb_detect_encoding($text); + + $newText = $this->application->ConvertCharset($text, $this->defaultCharset, $this->encoding); $newText = strip_tags($newText); $newText = str_replace("&", "&", $newText); return $newText;