geany  1.38
About: Geany is a text editor (using GTK2) with basic features of an integrated development environment (syntax highlighting, code folding, symbol name auto-completion, ...). F: office T: editor programming GTK+ IDE
  Fossies Dox: geany-1.38.tar.bz2  ("unofficial" and yet experimental doxygen-generated source code documentation)  

encodings.h File Reference

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

#include "gtkcompat.h"
Include dependency graph for encodings.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  GeanyEncodingIndex {
  GEANY_ENCODING_ISO_8859_1 , GEANY_ENCODING_ISO_8859_2 , GEANY_ENCODING_ISO_8859_3 , GEANY_ENCODING_ISO_8859_4 ,
  GEANY_ENCODING_ISO_8859_5 , GEANY_ENCODING_ISO_8859_6 , GEANY_ENCODING_ISO_8859_7 , GEANY_ENCODING_ISO_8859_8 ,
  GEANY_ENCODING_ISO_8859_8_I , GEANY_ENCODING_ISO_8859_9 , GEANY_ENCODING_ISO_8859_10 , GEANY_ENCODING_ISO_8859_13 ,
  GEANY_ENCODING_ISO_8859_14 , GEANY_ENCODING_ISO_8859_15 , GEANY_ENCODING_ISO_8859_16 , GEANY_ENCODING_UTF_7 ,
  GEANY_ENCODING_UTF_8 , GEANY_ENCODING_UTF_16LE , GEANY_ENCODING_UTF_16BE , GEANY_ENCODING_UCS_2LE ,
  GEANY_ENCODING_UCS_2BE , GEANY_ENCODING_UTF_32LE , GEANY_ENCODING_UTF_32BE , GEANY_ENCODING_ARMSCII_8 ,
  GEANY_ENCODING_BIG5 , GEANY_ENCODING_BIG5_HKSCS , GEANY_ENCODING_CP_866 , GEANY_ENCODING_EUC_JP ,
  GEANY_ENCODING_EUC_KR , GEANY_ENCODING_EUC_TW , GEANY_ENCODING_GB18030 , GEANY_ENCODING_GB2312 ,
  GEANY_ENCODING_GBK , GEANY_ENCODING_GEOSTD8 , GEANY_ENCODING_HZ , GEANY_ENCODING_IBM_850 ,
  GEANY_ENCODING_IBM_852 , GEANY_ENCODING_IBM_855 , GEANY_ENCODING_IBM_857 , GEANY_ENCODING_IBM_862 ,
  GEANY_ENCODING_IBM_864 , GEANY_ENCODING_ISO_2022_JP , GEANY_ENCODING_ISO_2022_KR , GEANY_ENCODING_ISO_IR_111 ,
  GEANY_ENCODING_JOHAB , GEANY_ENCODING_KOI8_R , GEANY_ENCODING_KOI8_U , GEANY_ENCODING_SHIFT_JIS ,
  GEANY_ENCODING_TCVN , GEANY_ENCODING_TIS_620 , GEANY_ENCODING_UHC , GEANY_ENCODING_VISCII ,
  GEANY_ENCODING_WINDOWS_1250 , GEANY_ENCODING_WINDOWS_1251 , GEANY_ENCODING_WINDOWS_1252 , GEANY_ENCODING_WINDOWS_1253 ,
  GEANY_ENCODING_WINDOWS_1254 , GEANY_ENCODING_WINDOWS_1255 , GEANY_ENCODING_WINDOWS_1256 , GEANY_ENCODING_WINDOWS_1257 ,
  GEANY_ENCODING_WINDOWS_1258 , GEANY_ENCODING_NONE , GEANY_ENCODING_CP_932 , GEANY_ENCODINGS_MAX
}
 List of known and supported encodings. More...
 

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.

Definition in file encodings.h.

Enumeration Type Documentation

◆ GeanyEncodingIndex

List of known and supported encodings.

Enumerator
GEANY_ENCODING_ISO_8859_1 
GEANY_ENCODING_ISO_8859_2 
GEANY_ENCODING_ISO_8859_3 
GEANY_ENCODING_ISO_8859_4 
GEANY_ENCODING_ISO_8859_5 
GEANY_ENCODING_ISO_8859_6 
GEANY_ENCODING_ISO_8859_7 
GEANY_ENCODING_ISO_8859_8 
GEANY_ENCODING_ISO_8859_8_I 
GEANY_ENCODING_ISO_8859_9 
GEANY_ENCODING_ISO_8859_10 
GEANY_ENCODING_ISO_8859_13 
GEANY_ENCODING_ISO_8859_14 
GEANY_ENCODING_ISO_8859_15 
GEANY_ENCODING_ISO_8859_16 
GEANY_ENCODING_UTF_7 
GEANY_ENCODING_UTF_8 
GEANY_ENCODING_UTF_16LE 
GEANY_ENCODING_UTF_16BE 
GEANY_ENCODING_UCS_2LE 
GEANY_ENCODING_UCS_2BE 
GEANY_ENCODING_UTF_32LE 
GEANY_ENCODING_UTF_32BE 
GEANY_ENCODING_ARMSCII_8 
GEANY_ENCODING_BIG5 
GEANY_ENCODING_BIG5_HKSCS 
GEANY_ENCODING_CP_866 
GEANY_ENCODING_EUC_JP 
GEANY_ENCODING_EUC_KR 
GEANY_ENCODING_EUC_TW 
GEANY_ENCODING_GB18030 
GEANY_ENCODING_GB2312 
GEANY_ENCODING_GBK 
GEANY_ENCODING_GEOSTD8 
GEANY_ENCODING_HZ 
GEANY_ENCODING_IBM_850 
GEANY_ENCODING_IBM_852 
GEANY_ENCODING_IBM_855 
GEANY_ENCODING_IBM_857 
GEANY_ENCODING_IBM_862 
GEANY_ENCODING_IBM_864 
GEANY_ENCODING_ISO_2022_JP 
GEANY_ENCODING_ISO_2022_KR 
GEANY_ENCODING_ISO_IR_111 
GEANY_ENCODING_JOHAB 
GEANY_ENCODING_KOI8_R 
GEANY_ENCODING_KOI8_U 
GEANY_ENCODING_SHIFT_JIS 
GEANY_ENCODING_TCVN 
GEANY_ENCODING_TIS_620 
GEANY_ENCODING_UHC 
GEANY_ENCODING_VISCII 
GEANY_ENCODING_WINDOWS_1250 
GEANY_ENCODING_WINDOWS_1251 
GEANY_ENCODING_WINDOWS_1252 
GEANY_ENCODING_WINDOWS_1253 
GEANY_ENCODING_WINDOWS_1254 
GEANY_ENCODING_WINDOWS_1255 
GEANY_ENCODING_WINDOWS_1256 
GEANY_ENCODING_WINDOWS_1257 
GEANY_ENCODING_WINDOWS_1258 
GEANY_ENCODING_NONE 
GEANY_ENCODING_CP_932 
GEANY_ENCODINGS_MAX 

Definition at line 49 of file encodings.h.

Function Documentation

◆ encodings_convert_to_utf8()

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_encoding (out) 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.

Definition at line 784 of file encodings.c.

References encodings_check_regexes(), and encodings_convert_to_utf8_with_suggestion().

◆ encodings_convert_to_utf8_from_charset()

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.

Definition at line 625 of file encodings.c.

References geany_debug(), and NULL.

Referenced by encodings_convert_to_utf8_with_suggestion(), get_symbol_name(), get_symbol_tooltip(), handle_encoding(), and handle_forced_encoding().

◆ encodings_get_charset_from_index()

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

Definition at line 267 of file encodings.c.

References GeanyEncoding::charset, encodings, GEANY_ENCODINGS_MAX, and NULL.

Referenced by on_find_in_files_dialog_response(), and open_session_file().