| Top |
| GflsEncoding * | gfls_encoding_new () |
| GflsEncoding * | gfls_encoding_new_utf8 () |
| GflsEncoding * | gfls_encoding_new_from_locale () |
| GflsEncoding * | gfls_encoding_copy () |
| gpointer | gfls_encoding_copy_func () |
| void | gfls_encoding_free () |
| const gchar * | gfls_encoding_get_charset () |
| gboolean | gfls_encoding_has_known_charset () |
| const gchar * | gfls_encoding_get_name () |
| gchar * | gfls_encoding_to_string () |
| gboolean | gfls_encoding_is_utf8 () |
| gboolean | gfls_encoding_is_locale () |
| gboolean | gfls_encoding_equals () |
| gint | gfls_encoding_compare_func () |
| GSList * | gfls_encoding_get_all () |
| GSList * | gfls_encoding_get_default_candidates () |
| GSList * | gfls_encoding_remove_duplicates () |
The GflsEncoding boxed type represents a character encoding.
Note that the text in GTK widgets is always encoded in UTF-8.
GflsEncoding *
gfls_encoding_new (const gchar *charset);
Creates a new GflsEncoding from a character set such as "UTF-8" or "ISO-8859-1".
The gfls_encoding_get_charset() function will return exactly the same string
as the charset
passed in to this constructor.
Since: 0.5
GflsEncoding *
gfls_encoding_new_utf8 (void);
Creates a new GflsEncoding with the "UTF-8" character set.
Since: 0.5
GflsEncoding *
gfls_encoding_new_from_locale (void);
Creates a new GflsEncoding from the current locale, as returned by
g_get_charset().
Since: 0.5
gpointer gfls_encoding_copy_func (gconstpointer src,gpointer data);
A GCopyFunc provided for convenience. It does the same as
gfls_encoding_copy(). It is useful for example for g_slist_copy_deep().
Since: 0.5
const gchar *
gfls_encoding_get_charset (const GflsEncoding *enc);
Gets the character set of the GflsEncoding, such as "UTF-8" or "ISO-8859-1".
Since: 0.5
gboolean
gfls_encoding_has_known_charset (const GflsEncoding *enc);
Returns TRUE if enc
has a charset known by GflsEncoding. In other words:
if enc
is equal to an encoding returned by gfls_encoding_get_all().
When the charset string comes from an untrusted source, it can be desirable to check it.
Since: 0.5
const gchar *
gfls_encoding_get_name (const GflsEncoding *enc);
Gets the name of the GflsEncoding such as "Unicode" or "Western". If the charset is unknown by GflsEncoding, "Unknown" is returned. The return value is already translated by gettext.
Since: 0.5
gchar *
gfls_encoding_to_string (const GflsEncoding *enc);
Returns the encoding name with the charset in parenthesis, for example "Unicode (UTF-8)". If the name is unknown, just the charset is returned. The name is translated by gettext.
Since: 0.5
gboolean
gfls_encoding_is_utf8 (const GflsEncoding *enc);
Returns whether enc
is a UTF-8 encoding.
If enc
was created with gfls_encoding_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.
Since: 0.5
gboolean gfls_encoding_equals (const GflsEncoding *enc1,const GflsEncoding *enc2);
Returns whether enc1
and enc2
are equal. It returns TRUE if and only if:
Both enc1
and enc2
are NULL;
Or both enc1
and enc2
have a UTF-8 charset (see
gfls_encoding_is_utf8());
Or the charsets are equal according to g_ascii_strcasecmp() (because
iconv-compatible charsets are case insensitive).
Since: 0.5
gint gfls_encoding_compare_func (gconstpointer a,gconstpointer b);
A GCompareFunc provided for convenience. When 0 is returned it means that
the two encodings are equal according to gfls_encoding_equals().
It is useful for example for g_slist_find_custom().
Since: 0.5
GSList *
gfls_encoding_get_all (void);
Gets a list of all encodings known by GflsEncoding.
Since: 0.5
GSList *
gfls_encoding_get_default_candidates (void);
Gets the list of default candidate encodings to try when loading a file.
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 GflsEncoding, it is a limited list that contains only the encodings that have the most likelihood to fit for the current locale.
Since: 0.5
GSList * gfls_encoding_remove_duplicates (GSList *list,GflsEncodingDuplicates removal_type);
A convenience function to remove duplicated encodings in a list.
Since: 0.5
Specifies which GflsEncoding occurrence to keep when removing duplicated
encodings in a list with gfls_encoding_remove_duplicates().
Since: 0.5