40

When I press tab for autocompletion I get this error:

-bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8)

I've tried running this:

locale-gen en_US en_US.UTF-8
dpkg-reconfigure locales
reboot

But it doesn't help. Do you know what is missing?

I'm running Ubuntu 13.04.

6

2 Answers 2

64

Fixed it by adding these lines to ~/.bash_profile on my local machine (OSX).

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
5
  • 2
    Actually, setting both LANG and LC_ALL makes little sense. And you should really take a look at /etc/default/locale to fix the issue system-wide. Jan 30, 2014 at 12:17
  • 1
    @GunnarHjalmarsson On the server it's LANG=en_US.UTF-8. That file doesn't exist on OSX. Jan 30, 2014 at 13:23
  • 1
    Missed that you connect remotely. So apparently your local locale settings are exported to the server. In any case, given that LANG is used on the server, setting LANG in ~/.bash_profile ought to be sufficient. help.ubuntu.com/community/… describes the various locale categories. Jan 30, 2014 at 16:40
  • I experienced the same problem (locale warning on tab for auto-complete) on remote sessions from OS X to Ubuntu. This answer worked for me as well.
    – Carl
    Oct 7, 2016 at 21:51
  • This did not work for ubuntu machine.
    – alper
    Mar 2, 2022 at 8:46
6

You may have some odd setting in /etc/default/locale. "UTF-8" is not a complete locale name.

0

Not the answer you're looking for? Browse other questions tagged .