Function

GLibget_filename_charsets

since: 2.6

Declaration [src]

gboolean
g_get_filename_charsets (
  const gchar*** filename_charsets
)

Description [src]

Determines the preferred character sets used for filenames. The first character set from the charsets is the filename encoding, the subsequent character sets are used when trying to generate a displayable representation of a filename, see g_filename_display_name().

On Unix, the character sets are determined by consulting the environment variables G_FILENAME_ENCODING and G_BROKEN_FILENAMES. On Windows, the character set used in the GLib API is always UTF-8 and said environment variables have no effect.

G_FILENAME_ENCODING may be set to a comma-separated list of character set names. The special token “`locale" is taken to mean the character set for the [current locale][setlocale]. IfG_FILENAME_ENCODINGis not set, butG_BROKEN_FILENAMES` is, the character set of the current locale is taken as the filename encoding. If neither environment variable is set, UTF-8 is taken as the filename encoding, but the character set of the current locale is also put in the list of encodings.

The returned charsets belong to GLib and must not be freed.

Note that on Unix, regardless of the locale character set or G_FILENAME_ENCODING value, the actual file names present on a system might be in any random encoding or just gibberish.

Available since: 2.6

Parameters

filename_charsets

Type: An array of gchar**

return location for the NULL-terminated list of encoding names.

The argument will be set by the function.
The array must be NULL-terminated.
The returned data is owned by the function.
Each element is a NUL terminated UTF-8 string.

Return value

Type: gboolean

TRUE if the filename encoding is UTF-8.