Geany  dev
Data Structures | Enumerations | Functions
encodings.h File Reference

Encoding conversion and Byte Order Mark (BOM) handling. More...

Data Structures

struct  GeanyEncoding
 Structure to represent an encoding to be used in Geany. More...
 

Enumerations

enum  GeanyEncodingIndex
 List of known and supported encodings.
 

Functions

gchar * encodings_convert_to_utf8 (const gchar *buffer, gssize size, gchar **used_encoding)
 Tries to convert buffer into UTF-8 encoding and store the detected original encoding in used_encoding. More...
 
gchar * encodings_convert_to_utf8_from_charset (const gchar *buffer, gssize size, const gchar *charset, gboolean fast)
 Tries to convert buffer into UTF-8 encoding from the encoding specified with charset. More...
 
const gchar * encodings_get_charset_from_index (gint idx)
 Gets the character set name of the specified index e.g. More...
 

Detailed Description

Encoding conversion and Byte Order Mark (BOM) handling.

Function Documentation

gchar* encodings_convert_to_utf8 ( const gchar *  buffer,
gssize  size,
gchar **  used_encoding 
)

Tries to convert buffer into UTF-8 encoding and store the detected original encoding in used_encoding.

Parameters
bufferthe input string to convert.
sizethe length of the string, or -1 if the string is nul-terminated.
used_encodingreturn location of the detected encoding of the input string, or NULL.
Returns
If the conversion was successful, a newly allocated nul-terminated string, which must be freed with g_free(). Otherwise NULL.
gchar* encodings_convert_to_utf8_from_charset ( const gchar *  buffer,
gssize  size,
const gchar *  charset,
gboolean  fast 
)

Tries to convert buffer into UTF-8 encoding from the encoding specified with charset.

If fast is not set, additional checks to validate the converted string are performed.

Parameters
bufferThe input string to convert.
sizeThe length of the string, or -1 if the string is nul-terminated.
charsetThe charset to be used for conversion.
fastTRUE to only convert the input and skip extended checks on the converted string.
Returns
If the conversion was successful, a newly allocated nul-terminated string, which must be freed with g_free(). Otherwise NULL.
const gchar* encodings_get_charset_from_index ( gint  idx)

Gets the character set name of the specified index e.g.

for use with document_set_encoding().

Parameters
idxGeanyEncodingIndex to retrieve the corresponding character set.
Returns
The charset according to idx, or NULL if the index is invalid.
Since
0.13