Using the charmap.alias file

The name of the character set defined within the LANG/LC_ALL environment variables can wary from system to system. For example, on a given platform, the ISO-8859-1 character set may be named "iso88591", while others platform will use "8859-1".

An example of locale configuration on HP/UX:
$ export LANG=en_US.iso88591
$ locale
LANG=en_US.iso88591 
LC_CTYPE="en_US.iso88591" 
LC_COLLATE="en_US.iso88591" 
LC_MONETARY="en_US.iso88591" 
LC_NUMERIC="en_US.iso88591" 
LC_TIME="en_US.iso88591" 
LC_MESSAGES="en_US.iso88591" 
LC_ALL=
$ locale charmap 
"iso88591.cm"

To communicate with other components like front-ends, or identify the encoding of XML files, Genero programs must use a normalized name for character sets. This normalized name must follow the IANA specifications (RFC2978).

By default, the normalized character set name used by Genero is the value returned by the nl_langinfo() system function. To identify this name, compile and execute the following C program:

#include <stdio.h> 
#include <stdlib.h> 
#include <locale.h> 
#include <langinfo.h> 
int main()
{
  setlocale(LC_ALL, "");
  printf("%s\n", nl_langinfo(CODESET));
  exit(0);
}

The name provided by the nl_langinfo() function may not be a standard IANA character set name. To workaround this, Genero provides a character set name mapping file. The $FGLDIR/etc/charmap.alias file defines the translation of system specific locale character set names to normalized IANA names. This file can be modifed according to your needs.

To test a configuration, the normalized character set name can be shown with the 'fglrun -i mbcs' command. For example, if LANG is set to "en_US.iso88591" and the charmap.alias file contains the following line:
iso88591 ISO-8859-1

The normalized name sent to the front-end will be ISO-8859-1.

If no mapping line is found, the value returned by the nl_langinfo() function will be used as is.