## TeplEncodingIconv TeplEncodingIconv — Character encoding for iconv |

## Functions

const TeplEncoding * | tepl_encoding_iconv_to_base_type ()
TeplEncodingIconv * | tepl_encoding_iconv_new ()
TeplEncodingIconv * | tepl_encoding_iconv_new_utf8 ()
TeplEncodingIconv * | tepl_encoding_iconv_new_from_locale ()
TeplEncodingIconv * | tepl_encoding_iconv_copy ()
void | tepl_encoding_iconv_free ()
gchar * | tepl_encoding_iconv_to_string ()
gboolean | tepl_encoding_iconv_is_utf8 ()
gboolean | tepl_encoding_iconv_equals ()
GSList * | tepl_encoding_iconv_get_all ()
GSList * | tepl_encoding_iconv_get_default_candidates ()

## Types and Values

| TeplEncodingIconv

## Includes

    #include <tepl/tepl.h>

## Description

TeplEncodingIconv implements the TeplEncoding interface, for use with iconv in mind.

## Functions

### tepl_encoding_iconv_to_base_type ()

    const TeplEncoding *
    tepl_encoding_iconv_to_base_type (const TeplEncodingIconv *enc);

#### Parameters

enc | a TeplEncodingIconv object. |

#### Returns

the TeplEncoding object of `enc` .

Since: 6.4

### tepl_encoding_iconv_new ()

    TeplEncodingIconv *
    tepl_encoding_iconv_new (const gchar *charset);

Creates a new TeplEncodingIconv from a character set such as "UTF-8" or "ISO-8859-1".

The `tepl_encoding_get_name()` function will return exactly the same string as the `charset` passed in to this constructor.

[skip]

#### Parameters

charset | a character set. |

#### Returns

the new TeplEncodingIconv. Free with `tepl_encoding_iconv_free()`.

Since: 6.4

### tepl_encoding_iconv_new_utf8 ()

    TeplEncodingIconv *
    tepl_encoding_iconv_new_utf8 (void);

Creates a new TeplEncodingIconv with the "UTF-8" character set.

[skip]

#### Returns

the new TeplEncodingIconv. Free with `tepl_encoding_iconv_free()`.

Since: 6.4

### tepl_encoding_iconv_new_from_locale ()

    TeplEncodingIconv *
    tepl_encoding_iconv_new_from_locale (void);

Creates a new TeplEncodingIconv from the current locale, as returned by `g_get_charset()`.

[skip]

#### Returns

the new TeplEncodingIconv. Free with `tepl_encoding_iconv_free()`.

Since: 6.4

### tepl_encoding_iconv_copy ()

    TeplEncodingIconv *
    tepl_encoding_iconv_copy (const TeplEncodingIconv *enc);

[skip]

#### Parameters

enc | a TeplEncodingIconv. |

#### Returns

a copy of `enc` .

[transfer full]

Since: 6.4

### tepl_encoding_iconv_free ()

    void
    tepl_encoding_iconv_free (TeplEncodingIconv *enc);

#### Parameters

enc | a TeplEncodingIconv, or `NULL`. | [nullable]

Since: 6.4

### tepl_encoding_iconv_to_string ()

    gchar *
    tepl_encoding_iconv_to_string (const TeplEncodingIconv *enc);

Returns the encoding category name with the charset in parenthesis, for example "Unicode (UTF-8)". If the category name is unknown, just the charset is returned.

The category name is localized (i.e., already translated).

#### Parameters

enc | a TeplEncodingIconv. |

#### Returns

a string representation. Free with `g_free()` when no longer needed.

Since: 6.4

### tepl_encoding_iconv_is_utf8 ()

    gboolean
    tepl_encoding_iconv_is_utf8 (const TeplEncodingIconv *enc);

Returns whether `enc` is a UTF-8 encoding.

If `enc` was created with `tepl_encoding_iconv_new_utf8()`, the charset is "UTF-8". But iconv supports other variants: "UTF8", "utf-8" and "utf8". This function returns `TRUE` for all UTF-8 variants supported by iconv.

#### Parameters

enc | a TeplEncodingIconv. |

#### Returns

whether `enc` is a UTF-8 encoding.

Since: 6.4

### tepl_encoding_iconv_equals ()

    gboolean
    tepl_encoding_iconv_equals (const TeplEncodingIconv *enc1,
                                const TeplEncodingIconv *enc2);

Returns whether `enc1` and `enc2` are equal. It returns `TRUE` iff:

- Both `enc1` and `enc2` are `NULL`;

- Or both `enc1` and `enc2` have a UTF-8 charset (see `tepl_encoding_iconv_is_utf8()`);

- Or the charsets are equal according to `g_ascii_strcasecmp()` (because iconv-compatible charsets are case insensitive).

#### Parameters

enc1 | a TeplEncodingIconv, or `NULL`. | [nullable]
enc2 | a TeplEncodingIconv, or `NULL`. | [nullable]

#### Returns

whether `enc1` and `enc2` are equal.

Since: 6.4

### tepl_encoding_iconv_get_all ()

    GSList *
    tepl_encoding_iconv_get_all (void);

Gets a list of all encodings known by TeplEncodingIconv.

#### Returns

a list of TeplEncodingIconv's.

[transfer full][element-type TeplEncodingIconv]

Since: 6.4

### tepl_encoding_iconv_get_default_candidates ()

    GSList *
    tepl_encoding_iconv_get_default_candidates
                                   (void);

Gets the list of default candidate encodings to try when loading a file. See `gtk_source_file_loader_set_candidate_encodings()`.

This function returns a different list depending on the current locale (i.e. language, country and default encoding). The UTF-8 encoding and the current locale encoding are guaranteed to be present in the returned list.

Note that the returned list doesn't contain all encodings known by TeplEncodingIconv, it is a limited list that contains only the encodings that have the most likelihood to fit for the current locale.

#### Returns

the list of default candidate encodings.

[transfer full][element-type TeplEncodingIconv]

Since: 6.4

## Types and Values

### TeplEncodingIconv

    typedef struct _TeplEncodingIconv TeplEncodingIconv;