I have some problems using boost :: locale (1.49) on Debian 7 GNU / Linux (GCC version is 4.6.3-1). The code is saved in cp1251. Using functions such as "isalpha" (or "boost :: algorithm :: is_alpha") ends with an exception (bad_cast). There seems to be no right aspect for this check. Here is the code:
#include <iostream>
#include <boost/locale.hpp>
int main ()
{
boost::locale::generator gen;
std::locale loc(gen.generate("ru_RU.cp1251"));
unsigned char debug501 = '';
bool debug500 = std::isalpha(debug501, loc);
std::cout<< debug500;
return 0;
}
It works without any exceptions in Windows 7 with Visual Studio 2008. However, there is another problem: "debug500" in this case is false. It works fine only when the locale is generated as follows: std::locale loc(".1251"). But the same problem occurs when the locale is generated boost: std::locale loc(boost::locale::generator().generate("ru_RU.cp1251"));. I would appreciate it if someone could explain what is wrong with the code and / or how I can do a similar check (isalpha) using boost and std with the cp1251 language version.
source
share