Fixed Import mb_convert_encoding error

Mike

XenForo developer
Staff member
This is a 1.2 specific issue due to a switched code order and mbstring failing on some character sets. This will generally only affect non-Western European languages.

In library/XenForo/Importer/Abstract.php, change this: (it's at the very end)

Code:
            if (function_exists('mb_convert_encoding'))
            {
                $string = mb_convert_encoding($string, 'utf-8', $this->_charset);
            }
            else if (function_exists('iconv'))
            {
                $string = @iconv($this->_charset, 'utf-8//IGNORE', $string);
            }

to:

Code:
            $newString = false;
            if (function_exists('iconv'))
            {
                $newString = @iconv($this->_charset, 'utf-8//IGNORE', $string);
            }
            if (!$newString && function_exists('mb_convert_encoding'))
            {
                $newString = @mb_convert_encoding($string, 'utf-8', $this->_charset);
            }
            if ($newString)
            {
                $string = $newString;
            }
 
Top Bottom