How to find out the character encoding?
Nalin Dahyabhai
nalin at redhat.com
Wed May 5 21:01:22 UTC 2004
On Wed, May 05, 2004 at 10:49:05PM +0200, Björn Persson wrote:
> What is the canonical way for a program to find out which character
> encoding to use for standard input, standard output, command line
> parameters, environment variables et cetera? One could look at the LANG
> environment variable, but if no encoding is given there? Is ISO 8859-1
> the default for all languages?
ISO 8859-1 is frequently not the default. Typically you'll use a
combination of setlocale(3) and nl_langinfo(3) to learn about the
current locale. The APPLICATION NOTES section of the utf-8(7) man page
covers this in somewhat more detail.
HTH,
Nalin
More information about the fedora-list
mailing list