Reputation: 43
What is the meaning of setlocale()'s default setting? setlocale() defaults to "C" ("POSIX"). But what does that mean exactly ? Which is its default charset and language ? Is it "en_US.utf8" ?
Upvotes: 2
Views: 339
Reputation: 1424
The charset for locale "C" is required to contain all of the 7 bit ASCII characters, with the collating sequence based only on ASCII character codes. NO other characters outside ASCII are required. If the text being processed includes any characters outside that limited set, the behavior is undefined. As far as language, all the standard definitions in http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap07.html correspond to US English.
Upvotes: 0
Reputation: 111120
From N1570:
7.11.1.1 The setlocale function
3 A value of "C" for locale specifies the minimal environment for C translation; a value of "" for locale specifies the locale-specific native environment. Other implementation-defined strings may be passed as the second argument to setlocale.
Also, from footnote 222:
222) ISO/IEC 9945−2 specifies locale and charmap formats that may be used to specify locales for C.
This gives you an idea (since a footnote is strictly not part of the normative part of the standard) what "C" means in this context.
Upvotes: 2