protected function validateEncoding(): string
    {
        if (function_exists('mb_check_encoding')
            && mb_check_encoding($this->value, 'UTF-8')
        ) {
            return $this->value;
        }

        return function_exists('iconv')
            ? iconv('utf-8', 'utf-8', $this->value)
            : '';
    }
protected function validateEncoding(): string
    {
        if (function_exists('mb_check_encoding')
            && mb_check_encoding($this->value, 'UTF-8')
        ) {
            return $this->value;
        }

        return function_exists('iconv')
            ? iconv('utf-8', 'utf-8', $this->value)
            : '';
    }
protected function validateEncoding ( ) : string { if ( function_exists ( 'mb_check_encoding' ) && mb_check_encoding ( $ this -> value , 'UTF-8' ) ) { return $ this -> value ; } return function_exists ( 'iconv' ) ? iconv ( 'utf-8' , 'utf-8' , $ this -> value ) : '' ; }
Make sure the value is correctly encoded UTF-8.

This prevents the so-called "Invalid Encoding Attack".

@since 0.1.0

@return string Valid UTF-8 encoded string.
Make sure the value is correctly encoded UTF - 8 .