On 2020-11-01 17:17:49 -0300, Érico Nogueira wrote: > For what it's worth, if this is a bug, it would seem to be in how musl > decides when to print characters (not the formatting functions > themselves), since the below program doesn't print anything: > > #include > #include > > int main() { > fputws(L"[Привет Василий]\n", stdout); > // I don't know if I'm accessing a wchar_t appropriately here > fputwc(L"[Привет Василий]\n"[3], stdout); > return 0; > } > > I tried tracing the execution from fputws, and not printing anything > seems to be caused by the return value of wcsrtombs(). That seems to be on the right track, since when you actually check the return code from fputws: #include #include int main(void) { if (fputws(L"[Привет Василий]\n", stdout) == -1) { perror("fputws"); } } you get this: # ./a fputws: Illegal byte sequence I think it is caused by C (or POSIX) locale being default on entry to main, so you need to actually activate the system locale by calling setlocale(LC_ALL, ""). Indeed, if you modify the program to: #include #include #include int main(void) { setlocale(LC_ALL, ""); if (fputws(L"[Привет Василий]\n", stdout) == -1) { perror("fputws"); } } It starts to work: # ./a [Привет Василий] W. -- There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.