--- handler.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) --- handler.c +++ handler.c 2017-06-13 08:14:25.529321141 +0000 @@ -831,6 +831,7 @@ static int text_enriched_handler(struct enum { TEXT, + TEXT_GOTWC, LANGLE, TAG, BOGUS_TAG, @@ -868,7 +869,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--; @@ -876,6 +877,8 @@ static int text_enriched_handler(struct switch (state) { + case TEXT_GOTWC: + state = TEXT; case TEXT: switch (wc) { @@ -936,9 +939,8 @@ static int text_enriched_handler(struct enriched_flush(&stte, 1); else { - ungetwc(wc, s->fpin); bytes++; - state = TEXT; + state = TEXT_GOTWC; } break; @@ -1653,7 +1655,7 @@ void mutt_decode_attachment(struct Body * strip 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;