Setting locale

Ryan Schmidt ryandesign at macports.org
Thu May 22 22:47:09 PDT 2014


On May 22, 2014, at 3:36 PM, Gustavo Seabra wrote:

> On May 22, 2014, at 12:35 PM, Ryan Schmidt wrote:
> 
>> Assuming you're using the OS X Terminal application, check its Preferences window. Go to Settings, then Advanced, and make sure the checkbox "Set locale environment variables on startup" is checked.
> 
> Yes, it is checked, as you can see here: :-(
> 
> https://dl.dropboxusercontent.com/u/8599624/Lang2.png
> 
> However, it i set to “Unicode (UTF-8)”. Is this how it is supposed to be? I don’t see in the list anything like en_US.*.

Yes, you should use UTF-8. It appears the system constructs the locale (the "en_US" part) out of the combination of language and region that you select in System Preferences.


On May 22, 2014, at 9:39, Gustavo Seabra wrote:

> $ locale
> LANG=
> LC_COLLATE="C"
> LC_CTYPE="UTF-8"
> LC_MESSAGES="C"
> LC_MONETARY="C"
> LC_NUMERIC="C"
> LC_TIME="C"
> LC_ALL=

I get the same, if I set my OS X Language & Region preferences to Region: Brazil and Language: English as you have.

If I use Region: Brazil and Language: Portuguese, I get:

$ locale
LANG="pt_BR.UTF-8"
LC_COLLATE="pt_BR.UTF-8"
LC_CTYPE="pt_BR.UTF-8"
LC_MESSAGES="pt_BR.UTF-8"
LC_MONETARY="pt_BR.UTF-8"
LC_NUMERIC="pt_BR.UTF-8"
LC_TIME="pt_BR.UTF-8"
LC_ALL=

If I use Region: United States and Language: English, I get:

$ locale
LANG="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL=

I think this all comes down to the fact that "en_PT.UTF-8" is not one of the locales the operating system provides in /usr/share/locale, therefore it defaults to C instead, which causes some problems as you noticed. You should set the locale to one of the UTF-8 locales the system provides. If you don't want to use one of the system locales as your OS X language and region setting, you could still do so in the terminal by setting these environment variables in your shell startup file.



More information about the macports-users mailing list