### Function

# GLib get_console_charset

since: 2.62

#### Declaration

    gboolean
    g_get_console_charset (
      const char** charset
    )

#### Description

Obtains the character set used by the console attached to the process, which is suitable for printing output to the terminal.

Usually this matches the result returned by g_get_charset(), but in environments where the locale’s character set does not match the encoding of the console this function tries to guess a more suitable value instead.

On Windows the character set returned by this function is the output code page used by the console associated with the calling process. If the codepage can’t be determined (for example because there is no console attached) UTF-8 is assumed.

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.

Available since: 2.62

#### 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.