# Terminal should set LC_CTYPE rather than LANG

By default Terminal sets LANG at startup (Preferences → Advanced).

The intent here I assume is to get the various shell commands to work with UTF-8, which is great, since file names (and thus `ls` output) are UTF-8 and so is keyboard input.

Terminal should however only set LC_CTYPE, there are two reasons why setting LANG is problematic:

 1. In some contexts¹ Terminal is unable to obtain a value for language/region and sets LANG to just UTF-8. This does not carry over to LC_CTYPE, which means UTF-8 support does *not* work. To reproduce this go to System Preferences → International → Format and set Region to South Africa. Now open a new Terminal and type “locale”. The values I get are:


    An additional test is:
      % touch /tmp/æblegrød && ls /tmp/æblegrød

 2. The language that Terminal obtains (when it works) does not actually match my language preference. I.e. I have English at the top of Languages, but since I customized the Danish formats for dates, Terminal exported LANG as da_DK even though I prefer English output.

¹ Both me and someone I spoke to did a clean install of Leopard and had the default values for Region set to “Custom” which made UTF-8 not work in the Terminal by default.