* please see the file GPL in the top level source directory.
*/
-#if HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <ctype.h>
+#include <lib-lib/lib-lib.h>
-#include <sys/types.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <errno.h>
#ifdef HAVE_LANGINFO_CODESET
# include <langinfo.h>
#endif
-#include <lib-lib/mem.h>
-#include <lib-lib/ascii.h>
-#include <lib-lib/str.h>
-#include <lib-lib/macros.h>
-
#include "mutt.h"
#include "charset.h"
m_strreplace(&Charset, "iso-8859-1");
}
- Charset_is_utf8 = !strcmp(Charset, "utf-8");
+ Charset_is_utf8 = !m_strcmp(Charset, "utf-8");
CharsetReplacement = Charset_is_utf8 ? 0xfffd : '?';
#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
const char *p;
int i = 0;
+ if (!name) {
+ m_strcpy(dest, dlen, "us-ascii");
+ return;
+ }
+
// canonize name: only keep a-z0-9 and dots, put into lowercase
for (p = name; *p && *p != ':' && i < ssizeof(scratch) - 1; p++) {
if (isalnum(*p) || *p== '.') {
return fcharset;
}
-static int mutt_chscmp(const char *s, const char *chs)
-{
- char buffer[SHORT_STRING];
-
- if (!s)
- return 0;
-
- charset_canonicalize(buffer, sizeof(buffer), s);
- return !strcmp(buffer, chs);
-}
-
int charset_is_utf8(const char *s)
{
- return mutt_chscmp(s, "utf-8");
+ char buf[SHORT_STRING];
+ charset_canonicalize(buf, sizeof(buf), s);
+ return !m_strcmp(buf, "utf-8");
}
int charset_is_us_ascii(const char *s)
{
- return mutt_chscmp(s, "us-ascii");
+ char buf[SHORT_STRING];
+ charset_canonicalize(buf, sizeof(buf), s);
+ return !m_strcmp(buf, "us-ascii");
}
struct fgetconv_t *fc = p_new(struct fgetconv_t, 1);
fc->file = file;
+ fc->cd = MUTT_ICONV_ERROR;
if (from && to)
fc->cd = mutt_iconv_open(to, from, flags);