https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95048
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Status|UNCONFIRMED |NEW Last reconfirmed| |2020-05-11 --- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- This happens because glibc won't convert the wide string to UTF-8: #include <wchar.h> #include <assert.h> int main() { const wchar_t wstr[] = L"รค"; const wchar_t* from = wstr; char to[10]; mbstate_t s; size_t res = wcsnrtombs(to, &from, 1, sizeof(to), &s); assert(res != (size_t)-1); } I'm not yet sure why glibc refuses to convert that.