lib/ezutils/classes/ezuri.php
public static function encodeIRI( $str )
    {
        $codec = eZTextCodec::instance( false, 'utf-8' );
        $str = $codec->convertString( $str ); // Make sure the string is in utf-8
        $out = explode( "/", $str ); // Don't encode the slashes
        foreach ( $out as $i => $o )
        {
            if ( preg_match( "#^[\(]([a-zA-Z0-9_]+)[\)]#", $o, $m ) )
            {
                // Don't encode '(' and ')' in user parameters
                $out[$i] = '(' . urlencode( $m[1] ) . ')';
            }
            else
            {
                $out[$i] = urlencode( $o ); // Let PHP do the rest
            }
        }
        $tmp = join( "/", $out );
        // Don't encode '~' in URLs
        $tmp = str_replace( '%7E', '~', $tmp );
        return $tmp;
    }
public static function encodeIRI( $str )
    {
        $codec = eZTextCodec::instance( false, 'utf-8' );
        $str = $codec->convertString( $str ); // Make sure the string is in utf-8
        $out = explode( "/", $str ); // Don't encode the slashes
        foreach ( $out as $i => $o )
        {
            if ( preg_match( "#^[\(]([a-zA-Z0-9_]+)[\)]#", $o, $m ) )
            {
                // Don't encode '(' and ')' in user parameters
                $out[$i] = '(' . urlencode( $m[1] ) . ')';
            }
            else
            {
                $out[$i] = urlencode( $o ); // Let PHP do the rest
            }
        }
        $tmp = join( "/", $out );
        // Don't encode '~' in URLs
        $tmp = str_replace( '%7E', '~', $tmp );
        return $tmp;
    }
public static function encodeIRI ( $ str ) { $ codec = eZTextCodec :: instance ( false , 'utf-8' ) ; $ str = $ codec -> convertString ( $ str ) ; // Make sure the string is in utf-8 $ out = explode ( "/" , $ str ) ; // Don't encode the slashes foreach ( $ out as $ i => $ o ) { if ( preg_match ( "#^[\(]([a-zA-Z0-9_]+)[\)]#" , $ o , $ m ) ) { // Don't encode '(' and ')' in user parameters $ out [ $ i ] = '(' . urlencode ( $ m [ 1 ] ) . ')' ; } else { $ out [ $ i ] = urlencode ( $ o ) ; // Let PHP do the rest } } $ tmp = join ( "/" , $ out ) ; // Don't encode '~' in URLs $ tmp = str_replace ( '%7E' , '~' , $ tmp ) ; return $ tmp ; }
Encodes path string in internal encoding to a new string which conforms to the IRI specification.

More info on IRI here: {@link http://www.w3.org/International/O-URL-and-ident.html}

@param string $str the IRI to encode
@return string $str encoded as IRU
Encodes path string in internal encoding to a new string which conforms to the IRI specification .