mutt stable branch with some hacks
1/*
2 * Copyright (C) 1999-2003 Thomas Roessler <roessler@does-not-exist.org>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18
19#ifndef _CHARSET_H
20#define _CHARSET_H
21
22#ifdef HAVE_ICONV_H
23#include <iconv.h>
24#endif
25
26#ifndef HAVE_ICONV_T_DEF
27typedef void *iconv_t;
28#endif
29
30#ifndef HAVE_ICONV
31#define ICONV_CONST /**/
32iconv_t iconv_open (const char *, const char *);
33size_t iconv (iconv_t, ICONV_CONST char **, size_t *, char **, size_t *);
34int iconv_close (iconv_t);
35#endif
36
37int mutt_convert_string (char **, const char *, const char *, int);
38
39iconv_t mutt_iconv_open (const char *, const char *, int);
40size_t mutt_iconv (iconv_t, ICONV_CONST char **, size_t *, char **, size_t *, ICONV_CONST char **, const char *);
41
42typedef void * FGETCONV;
43
44FGETCONV *fgetconv_open (FILE *, const char *, const char *, int);
45int fgetconv (FGETCONV *);
46char * fgetconvs (char *, size_t, FGETCONV *);
47void fgetconv_close (FGETCONV **);
48
49void mutt_set_langinfo_charset (void);
50char *mutt_get_default_charset (void);
51
52/* flags for charset.c:mutt_convert_string(), fgetconv_open(), and
53 * mutt_iconv_open(). Note that applying charset-hooks to tocode is
54 * never needed, and sometimes hurts: Hence there is no MUTT_ICONV_HOOK_TO
55 * flag.
56 */
57#define MUTT_ICONV_HOOK_FROM 1 /* apply charset-hooks to fromcode */
58
59/* Check if given character set is valid (either officially assigned or
60 * known to local iconv implementation). If strict is non-zero, check
61 * against iconv only. Returns 0 if known and negative otherwise.
62 */
63int mutt_check_charset (const char *s, int strict);
64
65#endif /* _CHARSET_H */