Transcode mh_execm text/plain output like we do for mh_exec. Adjust handling of transcoding errors. These changes should fix most cases of non-utf8 text making it to unac/index

This commit is contained in:
Jean-Francois Dockes
2011-10-20 14:00:38 +02:00
parent d94a4ec315
commit f544b28b4a
7 changed files with 53 additions and 13 deletions
+10 -2
View File
@@ -116,7 +116,13 @@ bool transcode(const string &in, string &out, const string &icode,
ip++;isiz--;
continue;
}
goto error;
// Normally only EINVAL is possible here: incomplete
// multibyte sequence at the end. This is not fatal. Any
// other is supposedly impossible, we return an error
if (errno == EINVAL)
goto out;
else
goto error;
}
out.append(obuf, OBSIZ - osiz);
@@ -131,9 +137,11 @@ bool transcode(const string &in, string &out, const string &icode,
}
#endif
out:
ret = true;
error:
error:
if (icopen) {
#ifndef ICONV_CACHE_OPEN
iconv_close(ic);