# URI Utilities

Tracker defines some utility functions to deal with URI strings.

## Functions

### tracker_sparql_escape_uri

    gchar *
    tracker_sparql_escape_uri (const gchar * uri)

Calls tracker_sparql_escape_uri_printf.

Parameters:

`uri` –

a string to be escaped, following the tracker sparql rules

Returns ( [transfer: full]) –

a newly-allocated string holding the result. The returned string should be freed with g_free when no longer needed.

### Tracker.prototype.sparql_escape_uri

    function Tracker.prototype.sparql_escape_uri(uri: String): {
        // javascript wrapper for 'tracker_sparql_escape_uri'
    }

Calls tracker_sparql_escape_uri_printf (not introspectable).

Parameters:

`uri` (String) –

a string to be escaped, following the tracker sparql rules

Returns (String) –

a newly-allocated string holding the result. The returned string should be freed with GLib.prototype.free when no longer needed.

### Tracker.sparql_escape_uri

    def Tracker.sparql_escape_uri (uri):
        #python wrapper for 'tracker_sparql_escape_uri'

Calls tracker_sparql_escape_uri_printf (not introspectable).

Parameters:

`uri` (str) –

a string to be escaped, following the tracker sparql rules

Returns (str) –

a newly-allocated string holding the result. The returned string should be freed with GLib.free when no longer needed.

### tracker_sparql_escape_uri_printf

    gchar *
    tracker_sparql_escape_uri_printf (const gchar * format,
                                      ... ...)

Calls tracker_sparql_escape_uri_vprintf with the ... supplied.

Parameters:

`format` –

a standard printf format string, but notice string precision pitfalls documented in g_strdup_printf

`...` –

the parameters to insert into the format string

Returns ( [transfer: full]) –

a newly-allocated string holding the result.The returned string should be freed with g_free when no longer needed.

### tracker_sparql_escape_uri_vprintf

    gchar *
    tracker_sparql_escape_uri_vprintf (const gchar * format,
                                       va_list args)

Similar to the standard C vsprintf function but safer, since it calculates the maximum space required and allocates memory to hold the result.

The result is escaped using g_uri_escape_string.

Parameters:

`format` –

a standard printf format string, but notice string precision pitfalls documented in g_strdup_printf

`args` –

the list of parameters to insert into the format string

Returns ( [transfer: full]) –

a newly-allocated string holding the result. The returned string should be freed with g_free when no longer needed.

The results of the search are