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.
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.
const gchar * encodings_get_charset_from_index (gint idx)
 Gets the character set name of the specified index e.g.

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:
buffer the input string to convert.
size the length of the string, or -1 if the string is nul-terminated.
used_encoding return 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:
buffer The input string to convert.
size The length of the string, or -1 if the string is nul-terminated.
charset The charset to be used for conversion.
fast TRUE 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:
idx GeanyEncodingIndex to retrieve the corresponding character set.
Returns:
The charset according to idx, or NULL if the index is invalid.
Since:
0.13