From be7d19f47848a89be344b41e38790e740cd27fcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20R=C3=BChsen?= Date: Tue, 15 Dec 2015 10:55:41 +0100 Subject: [PATCH] Fix iconv conversion * src/iri.c: Kick out the last converted character from iconv() Thanks to Eli Zaretskii for suggesting the fix. Reported-by: "Andries E. Brouwer" --- src/iri.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/iri.c b/src/iri.c index dc9aa9ad..6c6e8d34 100644 --- a/src/iri.c +++ b/src/iri.c @@ -146,7 +146,8 @@ do_conversion (const char *tocode, const char *fromcode, char const *in_org, siz for (;;) { - if (iconv (cd, &in, &inlen, out, &outlen) != (size_t)(-1)) + if (iconv (cd, &in, &inlen, out, &outlen) != (size_t)(-1) && + iconv (cd, NULL, NULL, out, &outlen) != (size_t)(-1)) { *out = s; *(s + len - outlen - done) = '\0';