:right-sidebar: True Encoding =================================================================== .. currentmodule:: gi.repository.GtkSource .. class:: Encoding(*args, **kwargs) :no-contents-entry: Character encoding. The :obj:`~gi.repository.GtkSource.Encoding` boxed type represents a character encoding. It is used for example by :obj:`~gi.repository.GtkSource.File`\. Note that the text in GTK widgets is always encoded in UTF-8. Methods ------- .. rst-class:: interim-class .. class:: Encoding :no-index: .. method:: free() -> None Used by language bindings. .. classmethod:: get_all() -> list[~gi.repository.GtkSource.Encoding] Gets all encodings. .. method:: get_charset() -> str Gets the character set of the :obj:`~gi.repository.GtkSource.Encoding`\, such as "UTF-8" or "ISO-8859-1". .. classmethod:: get_current() -> ~gi.repository.GtkSource.Encoding Gets the :obj:`~gi.repository.GtkSource.Encoding` for the current locale. See also :obj:`~gi.repository.GLib.get_charset`\. .. classmethod:: get_default_candidates() -> list[~gi.repository.GtkSource.Encoding] Gets the list of default candidate encodings to try when loading a file. See :obj:`~gi.repository.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. .. classmethod:: get_from_charset() -> ~gi.repository.GtkSource.Encoding | None Gets a :obj:`~gi.repository.GtkSource.Encoding` from a character set such as "UTF-8" or "ISO-8859-1". .. method:: get_name() -> str Gets the name of the :obj:`~gi.repository.GtkSource.Encoding` such as "Unicode" or "Western". .. classmethod:: get_utf8() -> ~gi.repository.GtkSource.Encoding .. method:: to_string() -> str