Follow-up Comment #1, bug #22282 (project freeciv):
I wondered about just adding fc_strerror(fc_get_errno()) to the string.
However, on Windows, that turns into FormatMessage(GetLastError()),
effectively. This isn't appropriate for errors returned by iconv, which I
think sets the real errno (which is separate from GetLastError()) and thus
should have the real system strerror() called on it. (I think Windows has an
EILSEQ/EINVAL etc so should be able to provide useful strings for it.)
Nearby we have
/* TRANS: "Could not convert text from <encoding a> to <encoding b>:"
* <externally translated error string>."*/
fprintf(stderr, _("Could not convert text from %s to %s: %s"),
from, to, fc_strerror(fc_get_errno()));
which I think will currently do the Wrong Thing on Windows (should it ever
occur), so should be fixed at the same time.
However, I can't test Windows builds, so I'm not confident making these
(I guess we probably get away with calling fc_strerror() after fopen() etc
because that probably also sets the error code retrieved from GetLastError()
as well as the POSIX-y errno? But I don't think the third-party iconv library
will do so, or at least I've found no evidence in the source code.)
Reply to this item at:
Message sent via/by Gna!
Freeciv-dev mailing list