Why does std :: locale loc ("en_US") throw an exception?

I am trying to create an instance of an object std::localewith an American or British locale string.
Both std::locale loc("en_US")and std::locale loc("en_GB")throw an exception due to incorrect locale. Creating a locale using ""or "C"works fine; however, I am having problems setting up an individual language standard.

The reason I would like to do this is to test the modules to make sure that the collection of string sorting methods works correctly.

I must also indicate what I am encoding on Windows using Visual Studio 2008, and I would like to keep my cross platform, if possible.

+5
source share
2

, std::locale, ; , , .

Windows, Language Strings, , setlocal, / . , (, en-US, nl-BE zh-HK).

std:: locale:: global (std:: locale ( "zh-CN" )) " " ??

+6

boost.locale, ICU . ICU . std:: locale, :

boost::locale::generator gen;
std::locale loc = gen("en_US");

: http://www.boost.org/doc/libs/1_57_0_b1/libs/locale/doc/html/index.html

+5

All Articles