Function

GLibfilename_to_uri

Declaration

gchar*
g_filename_to_uri (
  const gchar* filename,
  const gchar* hostname,
  GError** error
)

Description

Converts an absolute filename to an escaped ASCII-encoded URI, with the path component following Section 3.3. of RFC 2396.

Parameters

filename const gchar*
 

An absolute filename specified in the GLib file name encoding, which is the on-disk file name bytes on Unix, and UTF-8 on Windows.

 The data is owned by the caller of the function.
 The string is a file system path, using the OS encoding.
hostname const gchar*
 

A UTF-8 encoded hostname, or NULL for none.

 The argument can be NULL.
 The data is owned by the caller of the function.
 The string is a NUL terminated UTF-8 string.
error GError **
  The return location for a GError*, or NULL.

Return value

Returns: gchar*
 

A newly-allocated string holding the resulting URI, or NULL on an error.

 The caller of the function takes ownership of the data, and is responsible for freeing it.
 The string is a NUL terminated UTF-8 string.