GLib.get_charset
Description: Reference for GLib.get_charset

### Function

# GLibget_charset

#### Declaration [src]

    gboolean
    g_get_charset (
      const char** charset
    )

#### Description [src]

Obtains the character set for the current locale; you might use this character set as an argument to g_convert(), to convert from the current locale’s encoding to some other encoding. (Frequently `g_locale_to_utf8()` and `g_locale_from_utf8()` are nice shortcuts, though.)

On Windows the character set returned by this function is the so-called system default ANSI code-page. That is the character set used by the “narrow” versions of C library and Win32 functions that handle file names. It might be different from the character set used by the C library’s current locale.

On Linux, the character set is found by consulting `nl_langinfo()` if available. If not, the environment variables `LC_ALL`, `LC_CTYPE`, `LANG` and `CHARSET` are queried in order. `nl_langinfo()` returns the C locale if no locale has been loaded by setlocale().

The return value is `TRUE` if the locale’s encoding is UTF-8, in that case you can perhaps avoid calling g_convert().

The string returned in `charset` is not allocated, and should not be freed.

#### Parameters

`charset`

  Type: `const char**`

  Return location for character set name, or `NULL`.

  The argument will be set by the function.
  The argument can be `NULL`.
  The returned data is owned by the function.
  The value is a NUL terminated UTF-8 string.

#### Return value

Type: `gboolean`

`TRUE` if the returned charset is UTF-8.