1 /* 2 * encodings.h - this file is part of Geany, a fast and lightweight IDE 3 * 4 * Copyright 2005 The Geany contributors 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License along 17 * with this program; if not, write to the Free Software Foundation, Inc., 18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 */ 20 21 22 /** 23 * @file encodings.h 24 * Encoding conversion and Byte Order Mark (BOM) handling. 25 **/ 26 27 /* 28 * Modified by the gedit Team, 2002. See the gedit AUTHORS file for a 29 * list of people on the gedit Team. 30 * See the gedit ChangeLog files for a list of changes. 31 */ 32 33 /* Stolen from anjuta */ 34 35 #ifndef GEANY_ENCODINGS_H 36 #define GEANY_ENCODINGS_H 1 37 38 #include "gtkcompat.h" 39 40 G_BEGIN_DECLS 41 42 /* 43 * The original versions of the following tables are taken from profterm 44 * 45 * Copyright (C) 2002 Red Hat, Inc. 46 */ 47 48 /** List of known and supported encodings. */ 49 typedef enum 50 { 51 GEANY_ENCODING_ISO_8859_1, 52 GEANY_ENCODING_ISO_8859_2, 53 GEANY_ENCODING_ISO_8859_3, 54 GEANY_ENCODING_ISO_8859_4, 55 GEANY_ENCODING_ISO_8859_5, 56 GEANY_ENCODING_ISO_8859_6, 57 GEANY_ENCODING_ISO_8859_7, 58 GEANY_ENCODING_ISO_8859_8, 59 GEANY_ENCODING_ISO_8859_8_I, 60 GEANY_ENCODING_ISO_8859_9, 61 GEANY_ENCODING_ISO_8859_10, 62 GEANY_ENCODING_ISO_8859_13, 63 GEANY_ENCODING_ISO_8859_14, 64 GEANY_ENCODING_ISO_8859_15, 65 GEANY_ENCODING_ISO_8859_16, 66 67 GEANY_ENCODING_UTF_7, 68 GEANY_ENCODING_UTF_8, 69 GEANY_ENCODING_UTF_16LE, 70 GEANY_ENCODING_UTF_16BE, 71 GEANY_ENCODING_UCS_2LE, 72 GEANY_ENCODING_UCS_2BE, 73 GEANY_ENCODING_UTF_32LE, 74 GEANY_ENCODING_UTF_32BE, 75 76 GEANY_ENCODING_ARMSCII_8, 77 GEANY_ENCODING_BIG5, 78 GEANY_ENCODING_BIG5_HKSCS, 79 GEANY_ENCODING_CP_866, 80 81 GEANY_ENCODING_EUC_JP, 82 GEANY_ENCODING_EUC_KR, 83 GEANY_ENCODING_EUC_TW, 84 85 GEANY_ENCODING_GB18030, 86 GEANY_ENCODING_GB2312, 87 GEANY_ENCODING_GBK, 88 GEANY_ENCODING_GEOSTD8, 89 GEANY_ENCODING_HZ, 90 91 GEANY_ENCODING_IBM_850, 92 GEANY_ENCODING_IBM_852, 93 GEANY_ENCODING_IBM_855, 94 GEANY_ENCODING_IBM_857, 95 GEANY_ENCODING_IBM_862, 96 GEANY_ENCODING_IBM_864, 97 98 GEANY_ENCODING_ISO_2022_JP, 99 GEANY_ENCODING_ISO_2022_KR, 100 GEANY_ENCODING_ISO_IR_111, 101 GEANY_ENCODING_JOHAB, 102 GEANY_ENCODING_KOI8_R, 103 GEANY_ENCODING_KOI8_U, 104 105 GEANY_ENCODING_SHIFT_JIS, 106 GEANY_ENCODING_TCVN, 107 GEANY_ENCODING_TIS_620, 108 GEANY_ENCODING_UHC, 109 GEANY_ENCODING_VISCII, 110 111 GEANY_ENCODING_WINDOWS_1250, 112 GEANY_ENCODING_WINDOWS_1251, 113 GEANY_ENCODING_WINDOWS_1252, 114 GEANY_ENCODING_WINDOWS_1253, 115 GEANY_ENCODING_WINDOWS_1254, 116 GEANY_ENCODING_WINDOWS_1255, 117 GEANY_ENCODING_WINDOWS_1256, 118 GEANY_ENCODING_WINDOWS_1257, 119 GEANY_ENCODING_WINDOWS_1258, 120 121 GEANY_ENCODING_NONE, 122 GEANY_ENCODING_CP_932, 123 124 GEANY_ENCODINGS_MAX 125 } 126 GeanyEncodingIndex; 127 128 gchar *encodings_convert_to_utf8(const gchar *buffer, gssize size, gchar **used_encoding); 129 130 /* Converts a string from the given charset to UTF-8. 131 * If fast is set, no further checks are performed. */ 132 gchar *encodings_convert_to_utf8_from_charset(const gchar *buffer, gssize size, 133 const gchar *charset, gboolean fast); 134 135 const gchar* encodings_get_charset_from_index(gint idx); 136 137 G_END_DECLS 138 139 #endif /* GEANY_ENCODINGS_H */ 140