From 5ce54327c23be27a6368650de0b69ac367b6bc87 Mon Sep 17 00:00:00 2001 From: "m.korolev" Date: Thu, 28 Nov 2013 15:42:22 +0400 Subject: [PATCH] get encoding from default site --- intaro.intarocrm/classes/general/ICMLLoader.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/intaro.intarocrm/classes/general/ICMLLoader.php b/intaro.intarocrm/classes/general/ICMLLoader.php index 20e08d5b..500c0e87 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 $encodingDefault = 'utf-8'; protected $fp; protected $mainSection = 1000000; @@ -28,6 +29,9 @@ class ICMLLoader { $this->isLogged = true; + $defaultSite = CSite::GetList($by="def", $order="desc", Array())->Fetch(); + $this->encodingDefault = $defaultSite["CHARSET"]; + $this->PrepareSettings(); $this->fp = $this->PrepareFile($this->filename. '.tmp'); @@ -78,12 +82,12 @@ class ICMLLoader { } protected function PrepareValue($text) - { - $newText = $this->application->ConvertCharset($text, mb_detect_encoding($text), $this->encoding); - $newText = strip_tags($newText); - $newText = str_replace("&", "&", $newText); - return $newText; - } + { + $newText = $this->application->ConvertCharset($text, $this->encodingDefault, $this->encoding); + $newText = strip_tags($newText); + $newText = str_replace("&", "&", $newText); + return $newText; + } protected function PrepareFile($filename) {