-
The character encoding conversion utility functions g_locale_to_utf8() and g_filename_to_utf8() had inconsistent behavior on producing strings with inner NUL bytes: in the all-UTF-8 strdup path, the input string validation prohibits embedded NULs, while g_convert(), using iconv(), can produce UTF-8 output with NUL bytes inside the output buffer. This, while valid UTF-8 per the Unicode standard, is not valid for the nul-terminated (type utf8) return value format that the *_to_utf8() functions are annotated with (as per discussion in bug 756128). Check the output of g_convert() for embedded NUL bytes, and if any are found, set the newly introduced error G_CONVERT_ERROR_EMBEDDED_NUL. Also document the error set by g_{locale,filename}_{from,to}_utf8() when the input string contains nul bytes. https://bugzilla.gnome.org/show_bug.cgi?id=792516
81cd8154