1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Fixed Import mb_convert_encoding error

Discussion in 'Resolved Bug Reports' started by Mike, Jul 31, 2013.

  1. Mike

    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;
                }
     
    boooooo and Moshe1010 like this.

Share This Page