Chapter 6. LOCALE technology
54
Bruno Haible's Unicode HOWTO (
ftp://ftp.ilog.fr/pub/Users/haible/utf8/Unicode HOWTO.
html
) also recommends this model.
6.1 Locale Categories and
setlocale()
In LOCALE model, the behaviors of some C functions are dependent on LOCALE environment.
LOCALE environment is divided into six categories and each of these categories can be set inde 
pendently using
setlocale()
.
The followings are the six categories:
LC_CTYPE Category related to encodings. Characters which are encoded by LC_CTYPE dependent
encoding is called multibyte characters. Note that multibyte character doesn't need to be
multibyte.
LC_CTYPE dependent functions are: character testing functions such as
islower()
and
so on, multibyte character functions such as
mblen()
and so on, multibyte string functions
such as
mbstowcs()
and so on, and so on.
LC_COLLATE Category related to sorting.
strcoll()
and so on are LC_COLLATE dependent.
LC_MESSAGES Category related to the language for messages the software outputs. This cate 
gory is used for
gettext
.
LC_MONETARY Category related to format to show monetary numbers, for example, currency
mark, comma or period, columns, and so on.
localeconv()
is the only function which is
LC_MONETARY dependent.
LC_NUMERIC Category related to format to show general numbers, for example, character for
decimal point.
Formatted I/O functions such as
printf()
, string conversion functions such as
atof()
,
and so on are LC_NUMERIC dependent.
LC_TIME Category related to format to show time and date, such as name of months and weeks,
order of date, month, and year, and so on.
strftime()
and so on are LC_TIME dependent.
setlocale()
is a function to set LOCALE. Usage is char *
setlocale(
int category, const char
*locale
);
. Header file of
locale.h
is needed for prototype declaration and definition of macros
for category names. For example,
setlocale(LC_TIME,  de_DE );
.
For category, the following macros can be used: LC_CTYPE, LC_COLLATE, LC_MONETARY,
LC_NUMERIC, LC_TIME, and LC_ALL. For locale, specific locale name,
NULL
, or
  
can be spec 
ified.






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