--- handler.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) --- handler.c +++ handler.c 2017-09-11 12:06:12.982065389 +0000 @@ -821,6 +821,7 @@ static int text_enriched_handler(struct enum { TEXT, + TEXT_GOTWC, LANGLE, TAG, BOGUS_TAG, @@ -858,7 +859,7 @@ static int text_enriched_handler(struct { if (state != ST_EOF) { - if (!bytes || (wc = fgetwc(s->fpin)) == WEOF) + if (state != TEXT_GOTWC && (!bytes || (fscanf (s->fpin, "%lc", &wc)) == EOF)) state = ST_EOF; else bytes--; @@ -866,6 +867,8 @@ static int text_enriched_handler(struct switch (state) { + case TEXT_GOTWC: + state = TEXT; case TEXT: switch (wc) { @@ -926,9 +929,8 @@ static int text_enriched_handler(struct enriched_flush(&stte, 1); else { - ungetwc(wc, s->fpin); bytes++; - state = TEXT; + state = TEXT_GOTWC; } break; @@ -1657,7 +1659,7 @@ void mutt_decode_attachment(struct Body * all trailing spaces to improve interoperability; if $text_flowed is unset, * simply verbatim copy input */ -static int text_plain_handler(struct Body *b, struct State *s) +static int text_plain_handler(struct Body *b __attribute__((unused)), struct State *s) { char *buf = NULL; size_t l = 0, sz = 0;