Habari\MultiByte::convert_encoding PHP Метод

convert_encoding() публичный статический Метод

Converts a string's encoding to a new encoding
public static convert_encoding ( $str, $use_enc = null, $from_enc = null ) : mixed
$str string. The string who's encoding is being changed.
$use_enc string. The encoding to convert to. If not set, the internal encoding will be used.
$from_enc string. encoding before conversion. If not set, encoding is detected automatically.
Результат mixed The source string in the new encoding or boolean false.
    public static function convert_encoding($str, $use_enc = null, $from_enc = null)
    {
        $ret = false;
        $enc = self::$hab_enc;
        if ($use_enc !== null) {
            $enc = $use_enc;
        }
        if (self::$use_library == self::USE_MBSTRING) {
            if ($from_enc == null) {
                $from_enc = MultiByte::detect_encoding($str);
            }
            $ret = mb_convert_encoding($str, $enc, $from_enc);
        }
        return $ret;
    }