diff --git a/libraries/ParserCSV.inc b/libraries/ParserCSV.inc index 5380201..6e33071 100644 --- a/libraries/ParserCSV.inc +++ b/libraries/ParserCSV.inc @@ -359,11 +359,13 @@ class ParserCSV { * Thrown when a given encoding does not match. */ public function fixEncoding($data) { - if ($this->useMbString && $this->toEncoding != $this->fromEncoding) { + if ($this->useMbString) { if (mb_check_encoding($data, $this->fromEncoding)) { - // Convert encoding. The conversion is to UTF-8 by default to prevent - // SQL errors. - $data = mb_convert_encoding($data, $this->toEncoding, $this->fromEncoding); + if ($this->toEncoding != $this->fromEncoding) { + // Convert encoding. The conversion is to UTF-8 by default to prevent + // SQL errors. + $data = mb_convert_encoding($data, $this->toEncoding, $this->fromEncoding); + } } else { throw new ParserCSVEncodingException(t('Source file is not in %encoding encoding.', array('%encoding' => $this->fromEncoding)));