Hot answers tagged

105 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-...
user avatar
72 votes

Why does [A-Z] match lowercase letters in bash?

Note that when using range expressions like [a-z], letters of the other case may be included, depending on the setting of LC_COLLATE. LC_COLLATE is a variable which determines the collation order ...
user avatar
  • 45.3k
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 ...
user avatar
49 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 ...
user avatar
46 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 ...
user avatar
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 ...
user avatar
37 votes
Accepted

locale-gen command in centos6

locale-gen is not present in Centos/Fedora. You must use localedef: localedef -v -c -i en_US -f UTF-8 en_US.UTF-8 From man localedef: NAME localedef - define locale environment SYNOPSIS ...
user avatar
  • 143k
37 votes
Accepted

What should I set my locale to and what are the implications of doing so?

Locale settings are user preferences that relate to your culture. Locale names On all current unix variants that I know of (but not on a few antiques), locale names follow the same pattern: An ISO ...
user avatar
37 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 ...
user avatar
32 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.
user avatar
  • 521
29 votes
Accepted

Bracket expression (without ranges) matching unexpected character in bash

That's a consequence of those characters having the same sorting order. You'll also notice that sort -u << EOF ■ ⅕ ⅖ ⅗ EOF returns only one line. Or that: expr ■ = ⅕ returns true (as ...
user avatar
27 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 ...
user avatar
  • 271
25 votes

Why does [A-Z] match lowercase letters in bash?

[A-Z] in bash matches all collating elements (characters but call also be sequence of characters like Dsz in Hungarian locales) that sort after A and sort before Z. In your locale, c probably sorts in-...
user avatar
21 votes
Accepted

Why is there no "Euro English" locale?

(a) An entity known as the Unicode Common Locale Data Repository seems to be the place that handles locales. The glibc wiki indicates that they will follow CLDR. (b) They have a locale known as "...
user avatar
  • 421
19 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 ...
user avatar
  • 481
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 ...
user avatar
16 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 ...
user avatar
15 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 ...
user avatar
  • 151
15 votes
Accepted

Understanding environmental variables in different contexts

The primary issue here -- which accounts for why, e.g., $PS1 is not reported by env -- is that env is reporting from a non-interactive environment. Processes are executed from a fork of your ...
user avatar
  • 82.2k
15 votes
Accepted

bash ssh warning when connect to raspberry: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)

ssh will forward "some" environnement var from mirind4-pc to raspberry, among them "locale" variable (which are use to print friendly date and number). According to misc link on Raspian and Ask ...
user avatar
  • 29.3k
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.
user avatar
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 ...
user avatar
  • 13.7k
14 votes

locale not found/setting locale failed - what should I do?

first: sudo apt-get purge locales then: sudo aptitude install locales and the famous: sudo dpkg-reconfigure locales This rids the system of locales, then re-installs locales and downgrades libc6 ...
user avatar
  • 321
14 votes
Accepted

Using localectl on Arch, Failed to issue method call: Invalid Locale data

Never mind, I was just using it wrongly. From info localectl: ...this [command] takes one or more assignments such as LANG=en_US.utf8
user avatar
  • 556
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 ...
user avatar
13 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] ...
user avatar
13 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 ...
user avatar
13 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 ...
user avatar
12 votes

How to set English as a default language in Debian?

Using sudo dpkg-reconfigure locales should work.
user avatar
  • 241
12 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 ...
user avatar
  • 7,768

Only top scored, non community-wiki answers of a minimum length are eligible