Linux - locale (LANG, LC environment variable)

About

Most UNIX systems use the LANG variable to specify the desired locale but you can use also the setlocale function.

A locale defines the default encoding for the text file.

How to

Obtain the locale values

To obtain the locale names for your UNIX system, enter the following:

locale -a
locale -a | grep -i en
en_AU
en_AU.iso88591
en_AU.utf8
en_BW
en_BW.iso88591
en_BW.utf8
en_CA
en_CA.iso88591
en_CA.utf8
en_DK
en_DK.iso88591
en_DK.utf8
en_GB
en_GB.iso88591
en_GB.iso885915
en_GB.utf8
en_HK
en_HK.iso88591
en_HK.utf8
en_IE
en_IE@euro
en_IE.iso88591
en_IE.iso885915@euro
en_IE.utf8
en_IN
en_IN.utf8
en_NZ
en_NZ.iso88591
en_NZ.utf8
en_PH
en_PH.iso88591
en_PH.utf8
en_SG
en_SG.iso88591
en_SG.utf8
en_US
en_US.iso88591
en_US.iso885915
en_US.utf8
en_ZA
en_ZA.iso88591
en_ZA.utf8
en_ZW
en_ZW.iso88591
en_ZW.utf8

Obtain the locale values

When invoked without arguments, locale summarizes the current locale environment for each locale category defined by the LC_* environment variables.

locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

Set a locale

With the setlocale function

setlocale

Install

  • Ubuntu
apt-get install -y locales
# if you really want to have all locales :)
apt-get install -y locales-all

Documentation / Reference





Discover More
Bash Liste Des Attaques Ovh
Bash - Set (of Bash Options)

The set builtin command can be specify shell option. When options are specified, they set or unset shell attributes. Without options, the name and value of each shell variable are displayed in a...
Card Puncher Data Processing
Docker - Encoding (Locale)

In docker linux, in order to set your default encoding, you need to set your locale via environment variable in your dockerfile Check/ List the locales If there is no locale, install them ...
Java Conceptuel Diagram
Java - Encoding

file encoding in Java the default one is defined by the OS: locale on Linux To define the code page to the JVM, you use the following command option: ASCII You need to set your encoding...
Windows Locale
Operating System - Locale (Character Set)

This page is the locale of the operating system The locale will set the default character set: of the operating system and of all application that does not overwrite it. locale Windows...
Powercenter 901 Installation License And Directory
PowerCenter - Installation and Configuration (9.0.1 for OEL Linux 64Bit)

Text format: ... Installation Type: Install (and not upgrade) Pre-requisites: Next License and Directory. (Transfer the license file from the client zip file) Pre-Installation Summary: Install...
Character Set Code Pages
Text - Encoding (Character Set|charset|code page)

A character set is a repertoire of characters in which each character is (assigned|encoded) into a numeric code point. An character set (as an alphabet) is any finite set of symbols (characters). In...



Share this page:
Follow us:
Task Runner