Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does ICU's Locale::getDefault() return "root"?

Tags:

c++

locale

icu

Using the ICU library with C++ I'm doing:

char const *lang = Locale::getDefault().getLanguage();

If I write a small test program and run it on my Mac system, I get en for lang. However, inside a larger group project I'm working on, I get root. Anybody have any idea why? I did find this:

http://userguide.icu-project.org/locale/resources

so my guess is that, when running under the larger system, some ICU resources aren't being found, but I don't know what resources, why they're not being found, or how to fix it.

Additional Information

/usr/bin/locale returns:

LANG="en_US.ISO8859-1"
LC_COLLATE="C" 
LC_CTYPE="C" 
LC_MESSAGES="C" 
LC_MONETARY="C" 
LC_NUMERIC="C" 
LC_TIME="C" 
LC_ALL="C" 

If I write a small C program:

char const *lang = setlocale( LC_ALL, "" ):

I get en_US.ISO8859-1.

OS: Mac OS X 10.6.4 (Snow Leopard)
ICU version: 4.3.4 (latest available via MacPorts).

A little help? Thanks.

like image 402
Paul J. Lucas Avatar asked Jun 19 '10 23:06

Paul J. Lucas


1 Answers

root is surely an odd default locale - you don't see many native root-speakers these days.

But seriously, is it safe to assume on the larger system that someone hasn't called one of the variants of setDefault("root")?

What does something like /usr/bin/locale return on this system (if you can run that)?

ICU 4.4 now has a test program called 'icuinfo', does it also return root as the default locale?

What OS/platform is this on, and which version of ICU?

like image 98
Steven R. Loomis Avatar answered Nov 15 '22 07:11

Steven R. Loomis