Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am getting the following errors when I execute some commands on Solaris 10.

couldn't set locale correctly

Output of locale command-

LANG=en_US
LC_CTYPE="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_COLLATE="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_ALL=

Does LC_ALL need to be set? I don't have root on this machine.. can I specify locale in my rc files?

share|improve this question
    
Which commands? –  Dennis Williamson Sep 16 '09 at 15:09
    
Running a perl script –  badkya Sep 16 '09 at 16:18
    
So is this any Perl script or just one? If the latter, can you post the part of your script that is causing the error? LC_ALL is used for overriding the other settings. –  Dennis Williamson Sep 16 '09 at 18:10
    
Do not set both LC_ALL and the other LC_ variables. Either unset LC_ALL, or set it to a valid value and unset the others. –  mark4o Sep 17 '09 at 13:57
    
I see... this shows up intermittently... I cannot seem to find a trend.. I'll hunt for the next instance of this error and try to find more about the command causing the error –  badkya Sep 17 '09 at 22:21

4 Answers 4

Locale settings are done via environment variables - you don't need to edit system files unless you want to change the defaults for every process on the system. The locale(5) and environ(5) man pages have more details on the various variables that affect locale settings.

locale -a will show the installed locales so you can make sure you've set it to one that's actually there.

share|improve this answer

You can use localeadm to install additional locales.

share|improve this answer

I suspect your Solaris installation is missing packages with locales. Try doing a full OS installation and then setting the locale.

share|improve this answer

locale -a gives you the list of installed locales. I believe that list doesn't contain en_US entry, so try setting LANG to "C" as well, or override it with setting LC_ALL to "C"

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.