char *setlocale(int category, const char *locale);
affects the behavior of regular expressions and the collation functions.
affects the behavior of regular expressions, character classification, and wide character functions.
affects what strings are expected by commands and utilities as affirmative or negative responses, what strings are given by commands and utilities as affirmative or negative responses, and the content of messages.
affects the behavior of functions that handle monetary values.
affects the radix character for the formatted input/output functions and the string conversion functions.
affects the behavior of time conversion functions.
If the locale name is a NULL pointer, the current locale setting is being queried. Otherwise, the specified locale name should be in the following format:
The territory field is usually a country name. In addition to the above format, the following special locale names are recognized:
Specifies a minimal environment for C-language translation called POSIX locale. If
setlocale()is not invoked by the program, the program behaves as if setlocale()had been invoked with this locale name.
Same as "POSIX".
Specifies that the locale name is determined by querying the process's environment for the following variables, in this order:
If set to a non-empty string, specifies the locale name to be used for all categories.
- LC_COLLATE, LC_CTYPE, LC_MESSAGES, LC_MONETARY, LC_NUMERIC, LC_TIME
If set to a non-empty string, and LC_ALL is not set, specifies the locale name to be used when
setlocale()is invoked for the corresponding category.
If set to a non-empty string, and neither LC_ALL nor the category-specific environment variable is set, specifies the locale name to be used.
If none of these environment variables is set to a non-empty string, the user's currently-configured system Regional Settings as the locale.
The locale state is common to all threads within a process.
Indicates the locale settings to query or change. It can be one of the values listed in the DESCRIPTION section.
Points to a string indicating country and language to choose for the locale. A null pointer for locale returns the current value used for the given category.
If successful, a pointer to the string for the locale associated with the given category is returned. On failure, a NULL is returned.
The string returned is such
that a subsequent call with the same category value and this
string as the locale setting with restore that part of the
program's locale. The string returned must not be modified by the
program, but may be overwritten by a subsequent call
UNIX 98, with exceptions
NuTCRACKER Platform locale information is built from the native Windows locale databases.
As such, the NuTCRACKER Platform cannot support more locale information
that is provided by Windows. LC_MESSAGES is read from
"yes/no" strings in the Windows language files if they are installed.
It also has the ability to read UNIX locale files from disk. However the tools
needed to produce these files and a sample set of files are not delivered
as of this release. The NuTCRACKER Platform
allows setting and querying the LC_MESSAGES category, and
supports its use in the NLSPATH environment variable used
In addition, if the locale is set to an empty string, and none of the environment variables defined above are specified, the NuTCRACKER Platform uses the system-configured Regional Settings to define the locale. On most UNIX platforms, the locale settings would default to the reading from /etc/locale
Windows locale names and UNIX locale names are usually quite different. Windows uses full language and country names, with code page values for the codeset. UNIX systems usually use two-letter abbreviations for language and country names (from ISO specifications 639 and 3166, respectively), and ISO codeset names. NuTCRACKER Platform accepts both forms without the need to use $ROOTDIR/etc/locale/locale.alias.
and UNIX long formatEnglish_United States.1252
and the Windows long formaten_US.ISO8859-1/C/fr_FR.UTF-8/ja_JP.sjis/ru_RU.ISO8859-5/C
Previous versions of NuTCRACKER Platform used a $ROOTDIR/etc/locale/locali.txt file for these now automatic mappings.LC_COLLATE=English_United States.1252;LC_CTYPE=C;LC_MONETARY=French_France.65001;LC_NUMERIC=Japanese_Japan.932;LC_TIME=Russian_Russia.1251;LC_MESSAGES=C
NuTCRACKER Platform reads $ROOTDIR/etc/locale/locale.alias, and provides a default to suppliment and enhance the default Windows to UNIX mappings. applications to recognize the UNIX-style locale names, a locale-alias database is provided in the file:
This file consists of mappings that allow alternative names for either the Windows or UNIX locale names.
The values returned by
whileprintf("%s\n", setlocale(LC_ALL, "en_US.ISO8859-1")) displays "en_US.ISO8859-1"
and the function output may be set for backward compatibilityprintf("%s\n", setlocale(LC_ALL, "en_US.ISO8859-1/C/fr_FR.UTF-8/ja_JP.sjis/ru_RU.ISO8859-5/C")) displays "en_US.ISO8859-1/C/fr_FR.UTF-8/ja_JP.sjis/ru_RU.ISO8859-5/C"
_NutConf(_NC_SET_LOCALE_FORMAT, 1); printf("%s\n", setlocale(LC_ALL, "en_US.ISO8859-1/C/fr_FR.UTF-8/ja_JP.sjis/ru_RU.ISO8859-5/C")) displays "LC_COLLATE=English_United States.1252;LC_CTYPE=C;LC_MONETARY=French_France.65001;LC_NUMERIC=Japanese_Japan.932;LC_TIME=Russian_Russia.1251;LC_MESSAGES=C"
is the same as callingsetlocale(LC_ALL, NULL);
Previous versions of NuTCRACKER Platform used the environment variable NUT_UTF8_LOCALE to indicate to override the console code page for console writes. This environement variable is no longer interrogated as a locale like en_US.UTF-8 (note the dash in UTF-8) do the same thing. In fact the charset part of the locale name is used to convert multi-byte to Unicode for console display.
The environment variable NUT_USE_WINDOWS_LOCALE_FORMAT causes the NuTCRACKER Platform to call
_NutConf(_NC_SET_LOCALE_FORMAT, 1) during startup and so affects the return value from
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
_NutConf(), fprintf(), fscanf(), isalnum(), isalpha(), iscntrl(), isgraph(), islower(), isprint(), ispunct(), isspace(), isupper(), iswalnum(), iswalpha(), iswcntrl(), iswgraph(), iswlower(), iswprint(), iswpunct(), iswspace(), iswupper(), localeconv(), mblen(), mbstowcs(), nl_langinfo(), printf(), querylocale(), scanf(), snprintf(), sprintf(), sscanf(), strcoll(), strerror(), strftime(), strtod(), strxfrm(), tolower(), toupper(), towlower(), towupper(), vfprintf(), vfscanf(), vprintf(), vscanf(), vsnprintf(), vsprintf(), vsscanf(), wcscoll(), wcsftime(), wcstod(), wcstombs(), wcsxfrm(), wctomb(), xlocale()
PTC MKS Toolkit 10.1 patch 1 Documentation Build 2.