Merge branch 'freebsd-iconv' into 'main'

gconvert: match GNU iconv behaviour on FreeBSD

See merge request GNOME/glib!3824
This commit is contained in:
Philip Withnall 2024-01-22 18:40:03 +00:00
commit b8fba4ddb4

View File

@ -73,7 +73,16 @@ try_conversion (const char *to_codeset,
if (*cd == (iconv_t)-1 && errno == EINVAL)
return FALSE;
else
#if defined(__FreeBSD__) && defined(ICONV_SET_ILSEQ_INVALID)
/* On FreeBSD request GNU iconv compatible handling of characters that cannot
* be repesented in the destination character set.
* See https://cgit.freebsd.org/src/commit/?id=7c5b23111c5fd1992047922d4247c4a1ce1bb6c3
*/
int value = 1;
if (iconvctl (*cd, ICONV_SET_ILSEQ_INVALID, &value) != 0)
return FALSE;
#endif
return TRUE;
}