private static function toUtf8($string) {

        if(static :: getEncoding() === 'utf-8') {
            $result = $string;
        }
        else {
            $result = static :: convert($string, static :: getEncoding(), 'UTF-8');
        }

        if(false === static :: isUtf8($result)) {
            return trigger_error(sprintf('String to be escaped was not valid UTF-8 or could not be converted'), E_USER_ERROR);
        }

        return $result;
    }
private static function toUtf8($string) {

        if(static :: getEncoding() === 'utf-8') {
            $result = $string;
        }
        else {
            $result = static :: convert($string, static :: getEncoding(), 'UTF-8');
        }

        if(false === static :: isUtf8($result)) {
            return trigger_error(sprintf('String to be escaped was not valid UTF-8 or could not be converted'), E_USER_ERROR);
        }

        return $result;
    }
private static function toUtf8 ( $ string ) { if ( static :: getEncoding ( ) === 'utf-8' ) { $ result = $ string ; } else { $ result = static :: convert ( $ string , static :: getEncoding ( ) , 'UTF-8' ) ; } if ( false === static :: isUtf8 ( $ result ) ) { return trigger_error ( sprintf ( 'String to be escaped was not valid UTF-8 or could not be converted' ) , E_USER_ERROR ) ; } return $ result ; }
Converts a string from UTF-8 to the base encoding
@param string $string
@return string
Converts a string from UTF - 8 to the base encoding