Current Default Locale
Your system will have a default locale. Normally, your default locale should be set to the language you want to use. To find out the current default locale on your system, you can run one of the following programs:
On UNIX Systems
#include <locale.h> #include <stdio.h> #include <langinfo.h> #if defined(linux) && !defined(CODESET) #define CODESET _NL_CTYPE_CODESET_NAME #endif /* linux */ int main() { char* loc = setlocale(LC_ALL, ""); if (loc) { printf("default locale: %s\n",loc); printf("encoding %s\n", nl_langinfo(CODESET)); } else printf("System does not support this locale\n"); return 0; } |
If your system is set to the French language, here is an example of what you will get on HP‑UX:
default locale: fr_FR.iso88591 fr_FR.iso88591 fr_FR.iso88591
fr_FR.iso88591 fr_FR.iso88591 fr_FR.iso88591
On Solaris, you will get:
default locale: fr
On Microsoft Windows Systems
#include <locale.h> #include <stdio.h> #include <windows.h> int main(int argc, char* argv[]) { printf("default locale: %s\n", setlocale(LC_ALL, "")); printf("encoding %d\n", GetACP()); return 0; } |
On Windows, if your regional setting has been set to French (Standard), you will get:
default locale: French_France.1252
encoding 1252
Version 6.3
Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.