Bug#175370: A reliable way to get LC_CTYPE encoding
firstname.lastname@example.org (Denis Barbier) writes:
> Unfortunately situation is much more complex (you must check LC_ALL and
> LC_CTYPE variables too), the simplest solution is to run 'locale charmap'
> to retrieve the current encoding.
In C program, nl_langinfo(CODESET) works reliably.
Though the function is mandated by XPG5 (X/Open Portability Guide,
Issue 5), some UNIX variants lack it. (Since GNU libc supports it,
dpkg and so on can safely use this.)
Tomohiro KUBOTA <email@example.com>