# locale

On many systems, "`/setenv LC_CTYPE=en_US`" will allow you to use characters in the 8-bit ISO 8859 character set. If this does not work on your system, or you want to use a non-English locale, or you just want to learn more, keep reading.

A locale defines a set of rules for a language and culture. If the platform on which TF runs supports locales, TF will support the following categories of locale rules:

LC_CTYPE
  determines what characters are allowed, and whether they should be treated as letters, digits, puctuation, or control characters. When using a locale with an 8-bit character set, make sure that %istrip is `off` and %meta_esc is `off` or `nonprint`, so you can type 8-bit characters with the meta key.
LC_TIME
  determines the names and formats used in displaying dates and times with /time, ftime(), etc.

The user can set the locale either by having special variables defined in the environment before starting TF (preferred), or by setting them while TF is running (they will automatically be exported to the environment even if /set is used). The exact rules for setting locale depend on the platform, and should be found your system's documentation for setlocale(). The rules are usually something like this:

1. If the variable LC_ALL is set, its value is used as the locale for all supported categories.
2. Otherwise, if the variable with the name of a category (e.g., LC_CTYPE) is set, its value is used as the locale for that category.
3. Otherwise, if the variable LANG is set, its value is used as the locale for any supported categories that were not covered by the first two rules.
4. If none of those are set for a category, the default "C" locale is used for that category, which allows the 7-bit ASCII character set and US English date and time formats.

The valid values for the locale variables depend on your system. On a POSIX system, the valid values can be listed with the shell command "`locale -a`".

Bugs:

- LC_COLLATE and LC_MESSAGES categories are not supported.
- In glob patterns, there is no way to specify a range of all letters that works in all locales. E.g., "[A-Za-z]" works in the standard "C" locale, but not necessarily in others. (However, in regexp patterns, locale information is used to define character type operators like "\w" and "\W", case insensitivity, etc.)
- TF will convert character 0x80 to the character 0x00. This is not usually an issue, since character 0x80 is not a printable character in the character sets of most locales (including all ISO character sets).

If your system has locale support, but does not have any locales installed, you can get the POSIX 1003.2 WG15-collection locale definitions from ftp://dkuug.dk/i18n/ or ftp://i44ftp.info.uni-karlsruhe.de/pub/linux/ctype/.

Note that even though TF supports locales with non-ASCII character sets, not all MUD servers support non-ASCII character sets. Many servers simply discard characters that are not printable ASCII. Among servers that do support non-ASCII characters, the most commonly used set is ISO-8859-1 (Latin1). When choosing a locale for TF, you should choose one that uses the same character set as the servers you use.

Note to linux users and other users of GNU libc: at least some versions of GNU localedef generate invalid LC_TIME information from the WG15-collection sources, and the GNU libc causes any program that tries to use the invalid LC_TIME information to crash. Workarounds: delete the LC_TIME data; or, do not set any of the LC_ALL, LC_TIME, or LANG variables.

Back to index
Back to tf home page

Copyright © 1995, 1996, 1997, 1998, 1999, 2002, 2003, 2004, 2005 Ken Keys