Quick guide for locale settings

This is a quick step-by-step guide to properly configure locale settings for your Genero application.

Setting the locale involves different components, make sure that all the components are properly configured. Consider also reading the complete localization chapter for more details.

  1. Identify the character set used by the program files (this can be 42m, 42for 42s files). The encoding used by these files is the character set that was configured at compile time on the development machine. Let's call this the application locale.
  2. Set the operating system locale corresponding to the application locale.
    • On a UNIX™ server, define the LANG (or LC_ALL) environment variable. Use locale -a command to check if the locale exists on the machine. If not, it must be installed. If not set, LANG defaults to POSIX (ASCII).
    • On a Windows™ server, check if the regional settings for non-UNICODE applications match the application locale. If the regional settings do no match, you can define the LANG environment variable with a locale name supported by Microsoft™ C Runtime Library, such as French_France.1252, or set LANG=.fglutf8 for the UTF-8 character set.
  3. Define byte or character length semantics with the FGL_LENGTH_SEMANTICS={BYTE|CHAR} environment variable. The default is Byte Length Semantics, which fits when the application locale is a single-byte character sets such as ISO-8859-1, or double-byte character sets like BIG5. With the UTF-8 Unicode locale, use Char Length Semantics.
  4. Check the charmap.alias file in FGLDIR/etc and verify that the name of the application locale is mapped to a normalized name. The normalized character set name must follow the IANA specifications (RFC2978) : it will be used by front-ends for character set conversion, and to identify the encoding of XML files.
  5. Set the database client locale with a character set corresponding to the application locale. For example, with Informix®, this is defined with the CLIENT_LOCALE environment variable. The name of the database client locale is certainly different from the application locale. But remember the application and database client character sets must match. The database server locale might be different from the db client locale.
  6. Check the length semantics used by the database. For example, with Oracle, you might want to set the database option NLS_LENGTH_SEMANTICS='CHAR', if the application uses CLS (typically with UTF-8).
  7. Set the front-end locale and font. By front-end, we mean the program the end user interacts with. This can be a Genero front-end or a terminal emulator like Gnome-term, Putty, or a Windows Console. When using a Genero front-end, the front-end character set is fixed by the type of the front end and conversion from/to application character set is automatic, but you may need to select a font different from the system default. If you want to execute a TUI application in a terminal emulator, you must be sure that the terminal is configured to display the correct character set. This is for example defined with the chcp command on Windows, or in the "Set Character Encoding" menu option of a Gnome-term.