[cvs] bogofilter/src charset_iconv.c,1.2,1.3
Fast Bayesian spam filter along lines suggested by Paul Graham
Brought to you by:
m-a
From: David R. <re...@us...> - 2005-02-13 00:32:23
|
Update of /cvsroot/bogofilter/bogofilter/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11742 Modified Files: charset_iconv.c Log Message: Replace invalid charset by default charset. Index: charset_iconv.c =================================================================== RCS file: /cvsroot/bogofilter/bogofilter/src/charset_iconv.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- charset_iconv.c 13 Feb 2005 00:28:58 -0000 1.2 +++ charset_iconv.c 13 Feb 2005 00:32:12 -0000 1.3 @@ -22,6 +22,7 @@ #include "common.h" #include <ctype.h> +#include <errno.h> #include <stdlib.h> #include <string.h> @@ -124,6 +125,12 @@ /* iconv_t iconv_open(const char *tocode, const char *fromcode); */ cd = iconv_open( DEFAULT_CHARSET, charset_name ); + if (cd == (iconv_t)(-1)) { + int err = errno; + if (err != EINVAL) + fprintf( stderr, "Invalid charset '%s'\n", charset_name ); + cd = iconv_open( DEFAULT_CHARSET, charset_default ); + } for (idx = 0; idx < COUNTOF(charsets); idx += 1) { |