39

A remote installed application has some encoding problems and on my local machine it is running fine.

What is the best way to "copy" my locales to the remote machine?

The locales on my personal machine are configured like this:

$ locale
LANG=de_DE.UTF-8
LANGUAGE=de_DE:en
LC_CTYPE="de_DE.UTF-8"
LC_NUMERIC=en_US.UTF-8
LC_TIME=en_US.UTF-8
LC_COLLATE="de_DE.UTF-8"
LC_MONETARY=en_US.UTF-8
LC_MESSAGES="de_DE.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=
Anwar
  • 77,855
d0x
  • 516

3 Answers3

37

You can set locale manually using update-locale:

sudo update-locale LANG=de_DE.UTF-8 LC_MESSAGES=POSIX

Read the man page for more information.

Alternatively, you can manually change your system's locale entries by modifying the file /etc/default/locale.

For example, on a German system, to prevent system messages from being translated, you may use:

LANG=de_DE.UTF-8
LC_MESSAGES=POSIX

Note: changes take effect only after a fresh login.

Source: https://help.ubuntu.com/community/Locale

Pablo Bianchi
  • 17,371
green
  • 14,406
14

The easier way

  1. Export all locales into a file

    locale > import

  2. Open file and add export at the start of each line

  3. Make it executable with the command chmod ugo+rx import

  4. Copy to desired profile and execute ./import

8

There are some recommendations when configuring locales in remote machines

  1. In Debian machines (remote machine), run the command (as root):

    sudo dpkg-reconfigure locales
    

    On the first screen, select the desired locales. After that, you will be prompted to choose which is the default locale. Select "none" (reference: https://wiki.debian.org/Locale#Standard).

  2. Configure your ssh service (/etc/ssh/sshd_config) to accept environment variables from the client: uncomment the line:

    AcceptEnv LANG LC_*
    

Restart your ssh server, logoff and log back in and run the locale command. It must match your local machine's locale.

Pablo Bianchi
  • 17,371
Girol
  • 301