Why does the following program
#include <stdio.h>
#include <wchar.h>
int main() {
wprintf(L"Привет, мир!");
}
print "Privet, mir!" on Linux? Specifically, why does it transliterate Russian text in Unicode into Latin as opposed to transcoding it into UTF-8 or using replacement characters?
Demonstration of this behavior on Godbolt: https://godbolt.org/z/36zEcG
The non-wide version printf("Привет, мир!")
prints this text as expected ("Привет, мир!").
wchar
on Linux? – Brownleewchar_t
since it's non-portable. I just came across this "interesting" behavior when answering another SO question: https://mcmap.net/q/223060/-how-i-can-print-the-wchar_t-values-to-console, – Misunderstanding??????, ???!
. Could you check/usr/share/i18n/locales/C
and see if there are any rules starting withtranslit
in there? – Chryselephantine