g_date_time_format fails when used with non ASCII format string on POSIX locale
g_date_time_format
fails with non ASCII format string on POSIX locale.
For example, following fails:
setlocale (LC_ALL, "C");
GDateTime *datetime = g_date_time_new_now_local ();
char *s = g_date_time_format (datetime, "ł");
assert (s != NULL);
Even though input and output are all UTF-8 strings, the current implementation internally performs the formatting using encoding configured in the current locale and then converts the result back into UTF-8. When intermediate result is not representable, formatting fails.
It would be probably better to do that other way around, store intermediate
result in UTF-8 and convert parts retrieved from nl_langinfo
if necessary.