| 1 | /* |
|---|
| 2 | * Copyright (C) 1999-2000 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 |
|---|
| 27 | typedef void *iconv_t; |
|---|
| 28 | #endif |
|---|
| 29 | |
|---|
| 30 | #ifndef HAVE_ICONV |
|---|
| 31 | #define ICONV_CONST /**/ |
|---|
| 32 | iconv_t iconv_open (const char *, const char *); |
|---|
| 33 | size_t iconv (iconv_t, ICONV_CONST char **, size_t *, char **, size_t *); |
|---|
| 34 | int iconv_close (iconv_t); |
|---|
| 35 | #endif |
|---|
| 36 | |
|---|
| 37 | int mutt_convert_string (char **, const char *, const char *, int); |
|---|
| 38 | |
|---|
| 39 | iconv_t mutt_iconv_open (const char *, const char *, int); |
|---|
| 40 | size_t mutt_iconv (iconv_t, ICONV_CONST char **, size_t *, char **, size_t *, ICONV_CONST char **, const char *); |
|---|
| 41 | |
|---|
| 42 | typedef void * FGETCONV; |
|---|
| 43 | |
|---|
| 44 | FGETCONV *fgetconv_open (FILE *, const char *, const char *, int); |
|---|
| 45 | int fgetconv (FGETCONV *); |
|---|
| 46 | char * fgetconvs (char *, size_t, FGETCONV *); |
|---|
| 47 | void fgetconv_close (FGETCONV **); |
|---|
| 48 | |
|---|
| 49 | void mutt_set_langinfo_charset (void); |
|---|
| 50 | char *mutt_get_default_charset (); |
|---|
| 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 M_ICONV_HOOK_TO |
|---|
| 55 | * flag. |
|---|
| 56 | */ |
|---|
| 57 | #define M_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 | */ |
|---|
| 63 | int mutt_check_charset (const char *s, int strict); |
|---|
| 64 | |
|---|
| 65 | #endif /* _CHARSET_H */ |
|---|