126
votes
Accepted
Problem of Can't set locale; make sure $LC_* and $LANG are correct!
Debian ships locales in source form. They need to be compiled explicitly. The reason for this is that compiled locales use a lot more disk space, but most people only use a few of them.
Run dpkg-...
68
votes
Accepted
Why does sort say that ɛ = e?
No, it doesn't consider them as equivalent, they just have the same primary weight. So that, in first approximation, they sort the same.
If you look at /usr/share/i18n/locales/iso14651_t1_common (as ...
50
votes
Accepted
Updated my arch linux server and now I get tmux: need UTF-8 locale (LC_CTYPE) but have ANSI_X3.4-1968
The same exact thing happened to me. Building on what Thomas said above, I was able to fix it by uncommenting en_US.UTF-8 UTF-8 in my /etc/locale.gen file (previously none of the lines had been ...
50
votes
Accepted
Which is the current decimal separator?
Ask locale:
locale decimal_point
This will output the decimal point using the current locale settings.
If you need the thousands separator:
locale thousands_sep
You can view all the numeric keywords ...
46
votes
Accepted
What is the difference between LANG=C and LC_ALL=C?
LANG sets the default locale, i.e. the locale used when no more specific setting (LC_COLLATE, LC_NUMERIC, LC_TIME etc.) is provided; it doesn’t override any setting, it provides the base value. LC_ALL ...
39
votes
Accepted
Can't generate en_US.UTF-8 Locale
You've tried to apply a recipe for Ubuntu under Debian. That usually works, but in this specific case it doesn't.
Ubuntu is derived from Debian, and doesn't change much apart from the installer and ...
37
votes
Problem of Can't set locale; make sure $LC_* and $LANG are correct!
The top-rated solution didn't help in my case, so I used this one:
export LC_ALL="en_US.UTF-8"
sudo dpkg-reconfigure locales
After that, I logged out and logged in and error was missing.
28
votes
When I'm typing a text in English, it gets underlined and behaves bizarrely
I also had this same issue (Arch XFCE). Basically what happens is it switches input methods whenever you press Shift+Space, which frequently accidentally happens when typing. To fix this, you have to ...
21
votes
Accepted
How can I make “ls” show dotfiles first while staying case-insensitive?
OP was very close with editing /usr/share/i18n/locales/iso14651_t1_common, but the trick is not to delete the line
<U002E> IGNORE;IGNORE;IGNORE;<U002E> # 47 .
but rather to modify it to
...
19
votes
Why is there no "Euro English" locale?
The en_DK locale doesn't really have anything to do with Denmark except for its name. It was originally created by someone who wanted the same thing as requested here - a reasonable set of defaults ...
18
votes
Accepted
Is "warning: range of the form `[o-b]' is locale dependent" a bug in gawk 4.1.0?
This is a bug in Gawk 4.1.0 specifically. It was introduced by a7c502a756732ec9a1773d6169376bb7b25f4308 and fixed by d52d17b46e53bb0d4a991cd32f859eb349d3b101. The bug was first released in 4.1.0 and ...
17
votes
Accepted
Debian 9: How to set English language with German Locale?
en_DE doesn’t exist as a default locale, so you can’t select English localised for German-speaking countries as a locale during installation. (Why should one use update-locale instead of directly ...
16
votes
Accepted
Unexpected sort order in en_US.UTF-8 locale
Sorting is done in multiple passes. Each character has three (or sometimes more) weights assigned to it. Let's say for this example the weights are
wt#1 wt#2 wt#3
space = [0000.0020.0002]
...
15
votes
Problem of Can't set locale; make sure $LC_* and $LANG are correct!
These commands saved my life
# echo "LC_ALL=en_US.UTF-8" >> /etc/environment
# echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
# echo "LANG=en_US.UTF-8" > /etc/locale.conf
# locale-gen ...
15
votes
Accepted
Why does the bash translation file not contain all error texts?
The string comes from strerror(3), which maps error numbers to messages. In this case, it's mapping EACCES. The strings (and their translations) are contained in your C library.
15
votes
Why does sort say that ɛ = e?
man sort:
*** WARNING *** The locale specified by the environment affects sort
order. Set LC_ALL=C to get the traditional sort order that uses native
byte values.
So, try: LC_ALL=C sort ...
14
votes
Problem of Can't set locale; make sure $LC_* and $LANG are correct!
If you're having this issue on a raspberry pi (or other?) and you're getting the error when you ssh to the pi there are 2 other solutions
One is edit /etc/ssh/sshd_config on the pi and comment out ...
14
votes
What are collating symbols and equivalence classes used for?
Collating symbols and equivalence classes are used in locale definitions to encode complex ordering information. POSIX has the details, but in summary:
a collating symbol represents a set of ...
14
votes
Accepted
Case sensitivity in square-bracket globbing
In bash version 4.3 and later, there is a shopt option called globasciiranges :
According to shopt builtin gnu man pages:
globasciiranges
If set, range expressions used in pattern matching
...
13
votes
Accepted
change locale in script
Inside the script, simply export LC_ALL=C.UTF-8¹ at the beginning (just after the shebang line, if any).
Then, all commands executed by the script will inherit LC_ALL.
If you need part of your script ...
13
votes
Accepted
Sort LC_ALL=C vs LC_ALL=C.utf8
LC_ALL=C sort sorts by byte value. It will sort any input written in any charset by byte value, not only ASCII¹.
The UTF-8 encoding has that property that sorting by byte value is the same as sorting ...
12
votes
Change LANG variable in current shell
Several things are required for that to work:
the it_IT.UTF-8 locale has to be available on the system. Check locale -a | grep it
the Italian translation for the corresponding application has to be ...
12
votes
What is the difference between LANG=C and LC_ALL=C?
LANG does not override:
$ export LC_NUMERIC="de_DE.UTF-8"
$ export LANG=C
$ printf "%.2f\n" 3.14
-bash: printf: 3.14: invalid number
3,00
But LC_ALL does:
$ export LC_NUMERIC="de_DE.UTF-8"
$ export ...
12
votes
awk doesn't recognize field as a number
The problem is that you have LC_NUMERIC=fr_BE.UTF-8. Under this locale, the decimal separator is , and not . so 98.9 is not considered a number. To illustrate:
$ echo "98.5" | LC_NUMERIC=C ...
11
votes
How can I make “ls” show dotfiles first while staying case-insensitive?
You can use the shell's sort order instead (which may not involve the locale's collation order; bash, AT&T ksh, yash, tcsh and zsh give the expected results, mksh and dash don't. fish seems to ...
11
votes
Accepted
"-bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)"
What your terminal is doing
The "rectangles with the numbers in [them]" are the way that your terminal emulator is displaying a terminal control sequence to you, because it doesn't recognize that ...
11
votes
Accepted
Arch Linux: Failed to set locale. Fix your system
One of your locale settings (namely, LC_TIME) is set to a locale that you have not generated (namely, en_GB.UTF-8). The error will go away if you enable that locale in /etc/locale.gen and regenerate ...
11
votes
Accepted
"sort -g" does not work as expected on data in scientific notation
2.3e-12 would be understood as 2 in a locale where the decimal radix character is , (as it is in most of the non-English speaking world including your de_DE.utf8) where the number would need to be ...
10
votes
Accepted
Why do some Linux utilities output Unicode (when it is not expected)?
It has everything to do with your system locale as it describes how utilities should output locale specific symbols and their combinations, e.g. ‘’ instead of "".
If you don't want this, use ...
10
votes
What value for LANG should I use for "sort -u“ correctly handle Chinese characters?
sort -u outputs one of each set of lines that collate the same (have identical sorting order) in the locale.
On GNU systems (systems using the GNU libc), in most locales, many characters¹ have an ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
locale × 515debian × 79
unicode × 50
linux × 45
character-encoding × 41
bash × 38
sort × 35
arch-linux × 32
date × 26
language × 24
centos × 23
ubuntu × 19
environment-variables × 17
terminal × 16
i18n × 15
shell × 14
ls × 14
macos × 13
linux-mint × 12
posix × 12
kde × 11
xfce × 11
x11 × 10
gnome × 10
keyboard-layout × 10