static int source_rc (const char *rcfile, BUFFER *err)
{
FILE *f;
- int line = 0, rc = 0;
+ int line = 0, rc = 0, conv = 0;
BUFFER token;
char *linebuf = NULL;
+ char *currentline = NULL;
size_t buflen;
pid_t pid;
memset (&token, 0, sizeof (token));
while ((linebuf = mutt_read_line (linebuf, &buflen, f, &line)) != NULL)
{
- if (mutt_parse_rc_line (linebuf, &token, err) == -1)
+ conv=ConfigCharset && (*ConfigCharset) && Charset;
+ if (conv)
+ {
+ currentline=safe_strdup(linebuf);
+ if (!currentline) continue;
+ mutt_convert_string(¤tline, ConfigCharset, Charset, 0);
+ }
+ else
+ currentline=linebuf;
+
+ if (mutt_parse_rc_line (currentline, &token, err) == -1)
{
mutt_error (_("Error in %s, line %d: %s"), rcfile, line, err->data);
- if (--rc < -MAXERRS)
+ if (--rc < -MAXERRS)
+ {
+ if (conv) FREE(¤tline);
break;
+ }
}
else
+ {
if (rc < 0)
rc = -1;
+ }
+ if (conv)
+ FREE(¤tline);
}
FREE (&token.data);
FREE (&linebuf);
** See the text describing the ``$$status_format'' option for more
** information on how to set ``$$compose_format''.
*/
+ { "config_charset", DT_STR, R_NONE, UL &ConfigCharset, UL 0 },
+ /*
+ ** .pp
+ ** When defined, Mutt will recode commands in rc files from this
+ ** encoding.
+ */
{ "confirmappend", DT_BOOL, R_NONE, OPTCONFIRMAPPEND, 1 },
/*
** .pp