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:
+10
-2
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user