Chapter 6. LOCALE technology
61
  encoding (
CODESET
)
For example, you can get names for months and use them for your original output algorithm.
YESEXPR
and
NOEXPR
are convenient for softwares expecting Y/N answer from users.
iconv_open()
,
iconv()
, and
iconv_close()
are functions to perform conversion between
encodings. Please consult manpages for them.
Combining
nl_langinfo()
and
iconv()
, you can easily modify Unicode enabled software
into locale sensible truly internationalized software.
At first, add a line of
setlocale(LC_ALL,   );
at the first of the software. If it returns non 
NULL, enable UTF 8 mode of the software.
int conversion = FALSE;
char *locale = setlocale(LC_ALL, "");
:
:
(original code to determine UTF 8 mode or not)
:
:
if (locale != NULL && utf_mode == FALSE) {
utf8_mode = TRUE;
conversion = TRUE;
}
Then modify input routine as following:
#define INTERNALCODE "UTF 8"
if (conversion == TRUE) {
char *fromcode = nl_langinfo(CODESET);
iconv_t conv = iconv_open(INTERNALCODE, fromcode);
(reading and conversion...)
iconv_close(conv);
} else {
(original reading routine)
}
Finally modify the output routine as following:
if (conversion == TRUE) {
char *tocode = nl_langinfo(CODESET);






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