51

Could not get @stone's answer to work. Instead, I use this method (for Dockerfiles): # Configure timezone and locale echo "Europe/Oslo" > /etc/timezone && \ dpkg-reconfigure -f noninteractive tzdata && \ sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ sed -i -e 's/# nb_NO.UTF-8 UTF-8/nb_NO.UTF-...


22

Answers here are incomplete as with most elsewhere. After piecing together information from a few places, what worked for me was to (1) make sure the locale I wanted was available (generate it if it wasn't) then (2) set locale related environment variables to desired locale. In my case I needed en_US.UTF-8 programmatically (i.e. non-interactively) installed ...


14

I figured it out! I needed to follow these steps: export DEBIAN_FRONTEND=noninteractive apt-get install locales echo "en_US.UTF-8 UTF-8" > /etc/locale.gen locale-gen and then the rest worked!


12

Simple way: Add LC_CTYPE="en_US.UTF-8" to /etc/sysconfig/i18n.


11

Here's a two-liner I've been using, which seems to work regardless of Windows version or local time settings: FOR /f %%a in ('WMIC OS GET LocalDateTime ^| find "."') DO set DTS=%%a set CUR_DATE=%DTS:~0,4%-%DTS:~4,2%-%DTS:~6,2% This will set a variable called %CUR_DATE% in the following ISO standard format: yyyy-mm-dd I tried making it a one-liner with &...


11

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 from 2.19 to 2.13 which is the issue. Then configures locales again.


10

Yes, you're probably quite fine. Assuming en_US.utf8 contains a UTF-8 American/English locale, it should work just fine. That's what I use myself: % echo $LANG en_US.UTF-8 If you run locale -v -a, it'll be a bit more descriptive: % locale -v -a locale: en_US archive: /usr/lib64/locale/locale-archive -----------------------------------------------...


9

Based on the fine work in @EirikW's answer. Specific to a Dockerfile: ENV LANG=en_GB.UTF-8 RUN apt-get install -y locales && \ sed -i -e "s/# $LANG.*/$LANG.UTF-8 UTF-8/" /etc/locale.gen && \ dpkg-reconfigure --frontend=noninteractive locales && \ update-locale LANG=$LANG


9

If this happens when SSHing to your box, but not on console, try reconfiguring your ssh client (on your local machine). On Mac OS X for example edit /private/etc/ssh_config and comment out # SendEnv LANG LC_* Thanks to the post of bredman on the Rasberry Pi Bulletin Board.


8

For me it was necessary to set the additional 3 ENV-Vars: # - Set the locale + timezone -------------------------------------------------- RUN echo "Europe/Vienna" > /etc/timezone && \ dpkg-reconfigure -f noninteractive tzdata && \ sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ sed -i -e 's/# ...


8

I had this problem for a long time and all the usual advice about dpkg-reconfigure locales, locale-gen, etc didn't help. So I played around a little bit with the environment variables, and what I found was that the system was borking on the LC_CTYPE environment variable! UTF-8 is not a valid value for it. Setting it to en_US.UTF-8 fixed it. To make the ...


7

To reconfigure the timezone and locales non-interactively, from within a script, here is what works for me (under Debian): For configuring the timezone, I first create '/etc/localtime' as a soft link to the appropriate zoneinfo file under the '/usr/share/zoneinfo' directory. Then, I run the dpkg-reconfigure command, and everything will be put in place. So, ...


7

Clean /usr/lib/locale/ (delete everything, do a backup if you are afraid). Delete unneeded locale from /etc/default/locale file (do not delete this file, edit and delete the locales) Delete unneeded locale from /var/lib/locales/supported.d/* files (do not delete this files, edit them and delete the locales) Regenerate locales (locale-gen --purge). Also you ...


7

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 from 2.19 to 2.13 which is the issue. Then configures locales again.


6

None of these answers worked for me, on an LXC container installed with: lxc-create -n sse-master -t download -n sse-master -- \ -d debian -r jessie --arch i386 I always got the following output from locale-gen, i.e. not generating any locales (none listed): $ sudo locale-gen Generating locales (this might take a while)... Generation complete. ...


6

TL;DR: en_US.utf8 is not an officially recognised locale as there is no IANA utf8 character set name. utf8 is likely generated by glibc - see final heading. The IANA character set name is UTF-8. The hyphen is important Case is insensitive Therefore, these are all valid: en_US.utf-8 en_US.UTF-8 en_US.uTf-8 There is also a !case-sensitive! alias for the ...


6

It seems the reason for this change is that in buster the en_US locale is updated. Since it is meant to represent US customs, which is to specify time in the 12 hour format, time is now shown as such, even though it may come as a surprise to everyone who has relied on the old behavior. A solution, as already mentioned by @JosefZ in the comments, is to use a ...


5

If you use SSH, there is another way to achieve the same result, which works in iTerm as well. You must modify the SSH configuration: sudo vi /etc/ssh_config Find and comment out the line containing SendEnv LANG LC_*


5

Red-Hat like distros (Centos, SL) come with file /etc/sysconfig/i18n which contains by default (well, in my case) LANG="en_GB" SYSFONT="latarcyrheb-sun16" And above file is being sourced by /etc/profile.d/lang.sh I my case I wanted to change en_GB.UTF-8 to en_GB.iso88591 so I found that “proper” way of doing it was to append ...


5

It seems that apt-get install locales-all solved my problem Thanks !


4

The problem here is that you use a different locale setting on your personal system, than is installed on the server you sshed to. Your local system uses en_GB while the remote system uses en_US.utf8. (Or I might have these reversed...either way, they don't match.) So when you ssh to the system, your locale settings are passed along, but the remote system ...


4

What are the contents of /etc/sysconfig/i18n? I typically set all of my servers to LANG="C" in that file. It's part of my build script, but it's helped me avoid terminal and emulation issues over the years. I'll update this with the real explanation later. # /etc/sysconfig/i18n LANG="C" SYSFONT="latarcyrheb-sun16"


4

Is specifying the user-preferred locale configurations in ~/.profile appropriate for your needs? Also, to save you the annoyance, stop forwarding locale from your client (/etc/ssh/ssh_config, comment out SendEnv LANG...) and stop accepting on the server (/etc/ssh/sshd_config).. Or, if you prefer, you can set a ~/.ssh/environment file with the options you ...


4

On CentOS you can use rpm -qf to find which package contains a file if you know it's full path rpm -qf /usr/bin/localedef If you don't know it's full path yu can do a search using yum yum provides '*/localedef' You'll find that it's in package glibc-common.


4

Explain to me why my configuration has not had the intended effect so I can understand it and not repeat the same errors in the future location ^/en/(.*) is not a valid directive. You might have been confused with location ^~ /en/(.*). This matches any query beginning with /en/ followed by anything. Actually, request always match the location / ...


3

Regional settings are applied per user. For the system account you can change it via the regisrty, see here Change the HKEY_USERS/.DEFAULT/International/sDecimal key


3

You can also do it from the Control Panel, without changing manually the registry. There's an option allowing you to apply the Current User settings to the System Accounts. Open Language --> Advanced settings --> Apply language settings to... Then click the button "Copy Settings" and check the option "Copy to Welcome Screen and System Accounts". Done.


3

PuTTY doesn't set LANG The locale you have set in PuTTY is completely decoupled from the environment variables on the system. To quote its documentation: Unfortunately, there is no satisfactory mechanism for PuTTY and the server to communicate this information, so it must usually be manually configured. Before PuTTY changed the default character ...


3

This set of instructions I found for Windows 7 on windows.microsoft.com seems to work: Open Region and Language by clicking the Start button, clicking Control Panel, clicking Clock, Language, and Region, and then clicking Region and Language. Click the Administrative tab, and then, under Language for non-Unicode programs, click Change system locale. If you'...


3

Although both timezone and locale are usually determined mostly by where you are located, timezone is NOT part of locale. It uses a different env var, TZ -- check if and to what that is set. If not set, the system default (for CentOS) is the file /etc/localtime which should be copied from whichever /usr/share/zoneinfo/** file is desired, in your case ...


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