protected function convertEncoding($str, $from = 'ISO-8859-1', $force = false)
    {
        if ($from !== 'UTF-8') {
            // mime header part decoding will force it.  This is necessary for
            // UTF-7 because mb_check_encoding will return true
            if ($force || !($this->charsetConverter->checkEncoding($str, 'UTF-8'))) {
                return $this->charsetConverter->convert($str, $from, 'UTF-8');
            }
        }
        return $str;
    }
protected function convertEncoding($str, $from = 'ISO-8859-1', $force = false)
    {
        if ($from !== 'UTF-8') {
            // mime header part decoding will force it.  This is necessary for
            // UTF-7 because mb_check_encoding will return true
            if ($force || !($this->charsetConverter->checkEncoding($str, 'UTF-8'))) {
                return $this->charsetConverter->convert($str, $from, 'UTF-8');
            }
        }
        return $str;
    }
protected function convertEncoding ( $ str , $ from = 'ISO-8859-1' , $ force = false ) { if ( $ from !== 'UTF-8' ) { // mime header part decoding will force it.  This is necessary for // UTF-7 because mb_check_encoding will return true if ( $ force || ! ( $ this -> charsetConverter -> checkEncoding ( $ str , 'UTF-8' ) ) ) { return $ this -> charsetConverter -> convert ( $ str , $ from , 'UTF-8' ) ; } } return $ str ; }
Ensures the encoding of the passed string is set to UTF-8.

The method does nothing if the passed $from charset is UTF-8 already, or
if $force is set to false and mb_check_encoding for $str returns true
for 'UTF-8'.

@param string $str
@param string $from
@param boolean $force
@return string utf-8 string
Ensures the encoding of the passed string is set to UTF - 8 .