24#ifndef MUTT_MUTT_CHARSET_H 
   25#define MUTT_MUTT_CHARSET_H 
   64#define MUTT_ICONV_NO_FLAGS  0  
   65#define MUTT_ICONV_HOOK_FROM 1  
   69int              mutt_ch_check(
const char *s, 
size_t slen, 
const char *from, 
const char *to);
 
   71char *           
mutt_ch_choose(
const char *fromcode, 
const struct Slist *charsets, 
const char *u, 
size_t ulen, 
char **d, 
size_t *dlen);
 
   81size_t           mutt_ch_iconv(iconv_t 
cd, 
const char **inbuf, 
size_t *inbytesleft, 
char **outbuf, 
size_t *outbytesleft, 
const char **
inrepls, 
const char *outrepl, 
int *iconverrno);
 
   89#define mutt_ch_is_utf8(str)     mutt_ch_chscmp(str, "utf-8") 
   90#define mutt_ch_is_us_ascii(str) mutt_ch_chscmp(str, "us-ascii") 
   93#define ICONV_T_INVALID ((iconv_t) -1) 
   96#define ICONV_ILLEGAL_SEQ ((size_t) -1) 
   98#define ICONV_BUF_TOO_SMALL ((size_t) -2) 
bool CharsetIsUtf8
Is the user's current character set utf-8?
wchar_t ReplacementChar
When a Unicode character can't be displayed, use this instead.
bool mutt_ch_check_charset(const char *cs, bool strict)
Does iconv understand a character set?
size_t mutt_ch_iconv(iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft, const char **inrepls, const char *outrepl, int *iconverrno)
Change the encoding of a string.
void mutt_ch_lookup_remove(void)
Remove all the character set lookups.
char * mutt_ch_choose(const char *fromcode, const struct Slist *charsets, const char *u, size_t ulen, char **d, size_t *dlen)
Figure the best charset to encode a string.
int mutt_ch_convert_nonmime_string(const struct Slist *const assumed_charset, const char *charset, char **ps)
Try to convert a string using a list of character sets.
#define ICONV_T_INVALID
Error value for iconv functions.
char * mutt_ch_get_langinfo_charset(void)
Get the user's choice of character set.
bool mutt_ch_lookup_add(enum LookupType type, const char *pat, const char *replace, struct Buffer *err)
Add a new character set lookup.
void mutt_ch_canonical_charset(char *buf, size_t buflen, const char *name)
Canonicalise the charset of a string.
void mutt_ch_cache_cleanup(void)
Clean up the cached iconv handles and charset strings.
const char * mutt_ch_iconv_lookup(const char *chs)
Look for a replacement character set.
int mutt_ch_convert_string(char **ps, const char *from, const char *to, uint8_t flags)
Convert a string between encodings.
LookupType
Types of character set lookups.
@ MUTT_LOOKUP_ICONV
Character set conversion.
@ MUTT_LOOKUP_CHARSET
Alias for another character set.
void mutt_ch_set_charset(const char *charset)
Update the records for a new character set.
int mutt_ch_check(const char *s, size_t slen, const char *from, const char *to)
Check whether a string can be converted between encodings.
const char * mutt_ch_charset_lookup(const char *chs)
Look for a replacement character set.
int mutt_ch_fgetconv(struct FgetConv *fc)
Convert a file's character set.
struct FgetConv * mutt_ch_fgetconv_open(FILE *fp, const char *from, const char *to, uint8_t flags)
Prepare a file for charset conversion.
char * mutt_ch_fgetconvs(char *buf, size_t buflen, struct FgetConv *fc)
Convert a file's charset into a string buffer.
bool mutt_ch_chscmp(const char *cs1, const char *cs2)
Are the names of two character sets equivalent?
void mutt_ch_fgetconv_close(struct FgetConv **ptr)
Close an fgetconv handle.
iconv_t mutt_ch_iconv_open(const char *tocode, const char *fromcode, uint8_t flags)
Set up iconv for conversions.
const char * mutt_ch_get_default_charset(const struct Slist *const assumed_charset)
Get the default character set.
static bool iconv_t_valid(const iconv_t cd)
Is the conversion descriptor valid?
String manipulation buffer.
Cursor for converting a file's encoding.
iconv_t cd
iconv conversion descriptor