public static function toUTF8($str)
    {
        if (!is_null($str) && false === mb_detect_encoding($str, 'UTF-8', true)) {
            $str = utf8_encode($str);
        }

        return $str;
    }
public static function toUTF8($str)
    {
        if (!is_null($str) && false === mb_detect_encoding($str, 'UTF-8', true)) {
            $str = utf8_encode($str);
        }

        return $str;
    }
public static function toUTF8 ( $ str ) { if ( ! is_null ( $ str ) && false === mb_detect_encoding ( $ str , 'UTF-8' , true ) ) { $ str = utf8_encode ( $ str ) ; } return $ str ; }
Convert string to utf-8 encoding if need
@param  string $str
@return string
Convert string to utf - 8 encoding if need