Language and character set settings

Purpose of application locale definition

The locale settings matters at compile time and at runtime. At runtime, the locale changes the behavior of the character handling functions, such as UPSHIFT and DOWNSHIFT. It also changes the handling of the character strings, which can be single byte or multibyte encoded. Compilation errors will occur if the source files contain characters that do not exist in the encoding defined by the current locale.

Always check that the local environment variable matches the locale of your Genero application, during development and at runtime:
$ fglrun -i
Charmap      : UTF-8
Multibyte    : yes
Stateless    : yes
Length Semantics : CHAR

Mobile platforms

On iOS and Android™ mobile platforms, the locale is automatically defined to be UTF-8. This cannot be changed.

The language conventions and system messages are defined by the device settings.

Microsoft™ Windows® platforms

On Windows platforms, when the LANG environment variable is undefined, the language and character set defaults to the system locale which is defined by the regional settings for "non-Unicode applications". For example, on a US-English Windows, this defaults to the 1252 code page.

It is not recommended to set the LANG variable, unless your application uses a UTF-8 locale. For Single Byte Character Set locales, use the Windows system locale.

To enable the UTF-8 encoding with FGL, define the LANG environment variable to .utf8:
C:\> set LANG=.utf8

Since Genero FGL 5.01.02, the .utf8 locale is recommended for UTF-8 on Windows platforms. For backward compatibility, LANG=.fglutf8 is still supported and is equivalent to LANG=.utf8.

Before version 5.01.02, Genero FGL implemented its own UTF-8 character handling on Windows, enabled with LANG=.fglutf8, because the C runtime library did not support UTF-8 locales. Starting with Windows 10 version 1803, the Universal C Runtime setlocale() function supports the UTF-8 code page, and Genero FGL now relies on it.

UNIX™ platforms

On UNIX-based platforms, The LANG/LC_ALL/LC_CTYPE environment variables define the local settings for the application.

The LC_CTYPE environment variable can be set to overwrite the LANG/LC_ALL setting. Make sure that LC_CTYPE does not define a different encoding than your application locale is requesting.

With the LANG/LC_ALL/LC_CTYPE environment variables, you define the language, the territory (aka country) and the codeset (aka character set or code page) to be used. The format of the value is normalized as follows, but may be specific on some operating systems:
language_territory.codeset
For example, to set English locale with ISO-8859-1 encoding:
$ LC_ALL=en_US.iso88591; export LC_ALL
UTF-8 is supported as well:
$ LC_ALL=en_US.utf8; export LC_ALL

What are possible locales on my platform?

Usually OS vendors define a specific set of values for the language, territory and codeset. For example, on a UNIX platform, you typically have the value "en_US.ISO8859-1" for a US English locale. A list of available locales can be found by running the locale -a command. You may also want to read the man pages of the locale command and the setlocale function.

On Microsoft Windows, use the default system encoding. For more details about supported locales, search the Microsoft MSDN documentation for "Language and Country/Region Strings".