Chapter 6. LOCALE technology
55
Giving
NULL
for locale will return the current value of the specified locale category. Otherwise,
setlocale()
returns the newly set locale name, or
NULL
for error.
Given
  
for locale,
setlocale()
will determine the locale name in the following manner:
  At first, consult
LC_ALL
environmental variable.
  If
LC_ALL
is not available, consult environmental variable same as the name of the locale
category. For example,
LC_COLLATE
.
  If none of them are available, consult
LANG
environmental variable.
This is why a user is expected to set
LANG
variable. In other words, all what a user has to do is to
set
LANG
variable so that all locale compliant softwares work well for desired way.
Thus, I recommend strongly to call
setlocale(LC_ALL,   );
at the first of your softwares, if
the softwares are to be international.
6.2 Locale Names
We can specify locale names for these six locale categories. Then, which name should we specify?
The syntax to build a locale name is determined as follows:
language[_territory][.codeset][@modifier]
where language is two lowercase alphabets described in ISO639, such as
en
for English,
eo
for
Esperanto, and
zh
for Chinese, territory is two uppercase alphabets described in ISO3166, such
as
GB
for United Kingdom,
KR
for Republic of Korea (South Korea),
CN
for China. There are
no standard for codeset and modifier. GNU libc uses
ISO 8859 1
,
ISO 8859 13
,
eucJP
,
SJIS
,
UTF8
, and so on for codeset, and
euro
for modifier.
However, it is depend on the system which locale names are valid. In other words, you have to
install locale database for locale you want to use. Type
locale  a
to display all supported locale
names on the system.
Note that locale names of
 C 
and
 POSIX 
are determined for the names for default behav 
ior. For example, when your software need to parse the output of
date(1)
, you'd better call
setlocale(LC_TIME,  C );
before invocation of
date(1)
.






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

indiana web hosting

 

Our partners: PHP: Hypertext Preprocessor Best Web Hosting Java Web Hosting Inexpensive Web Hosting  Jsp Web Hosting

Cheapest Web Hosting Jsp Hosting Cheap Hosting

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved