Comment 3 for bug 51624

Revision history for this message
Xeno Campanoli (xeno) wrote :

All the documents I'm seeing indicate you MAY NEED to pass "NULL" to setlocale to get the locale string back. On Feisty, when I run it this way, I get "C" back for my locale. Perhaps that is still wrong, but at least it's not the result above.

Here are a couple of URLs:

http://www.gnu.org/software/libc/manual/html_mono/libc.html
where there's the statement:
"You can also use this function to find out the current locale by passing a null pointer as the locale argument. In this case, setlocale returns a string that is the name of the locale currently selected for category category."

And in:
http://www.cppreference.com/stddate/all.html
You have the following statement:

"The setlocale() function is used to set and retrieve the current locale. If locale is NULL, the current locale is returned. Otherwise, locale is used to set the locale for the given category."

I believe that implies it doesn't give you a string otherwise, or at worst, nobody ever used it like that, and it is no longer maintained to do so. It's unfortunate that the documentation is not more specific, but the first one is pretty canonical.