Tepl.EncodingIconv

Fields

None

Methods

class

get_all ()

class

get_default_candidates ()

equals (enc2)

free ()

is_utf8 ()

to_base_type ()

to_string ()

Details

class Tepl.EncodingIconv
classmethod get_all()
Returns:

a list of Tepl.EncodingIconv's.

Return type:

[Tepl.EncodingIconv]

Gets a list of all encodings known by Tepl.EncodingIconv.

New in version 6.4.

classmethod get_default_candidates()
Returns:

the list of default candidate encodings.

Return type:

[Tepl.EncodingIconv]

Gets the list of default candidate encodings to try when loading a file. See GtkSource.FileLoader.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 Tepl.EncodingIconv, it is a limited list that contains only the encodings that have the most likelihood to fit for the current locale.

New in version 6.4.

equals(enc2)
Parameters:

enc2 (Tepl.EncodingIconv or None) – a Tepl.EncodingIconv, or None.

Returns:

whether self and enc2 are equal.

Return type:

bool

Returns whether self and enc2 are equal. It returns True iff:

New in version 6.4.

free()

New in version 6.4.

is_utf8()
Returns:

whether self is a UTF-8 encoding.

Return type:

bool

Returns whether self is a UTF-8 encoding.

If self 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.

New in version 6.4.

to_base_type()
Returns:

the Tepl.Encoding object of self.

Return type:

Tepl.Encoding

New in version 6.4.

to_string()
Returns:

a string representation. Free with GLib.free() when no longer needed.

Return type:

str

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

New in version 6.4.