boost-locale

How to format incomplete dates and times in a locale specific manner

流过昼夜 提交于 2019-12-23 16:07:20
问题 How can one format incomplete dates and/or a times in a locale specific manner? I have a date/time stored in a set of 7 strings: dayOfWeek - The day of the week. ([1,7]) dayOfMonth - The day of the month. ([1,31]) monthOfYear - The month of the year. ([0,11]) year - The year. ([-∞,∞]) hourOfDay - The hour of the day. ([0,11]) minuteOfHour - The minute of the hour. ([0,59]) meridianOfDay - The meridian of the day. ([0,1]) For various reasons, most of these are obtained through use of IR on web

stod does not work correctly with boost::locale

自作多情 提交于 2019-12-19 09:05:37
问题 I am trying to use boost::locale and std::stod together in a german locale where a comma is the decimal separator. Consider this code: boost::locale::generator gen; std::locale loc(""); // (1) //std::locale loc = gen(""); // (2) std::locale::global(loc); std::cout.imbue(loc); std::string s = "1,1"; //float string in german locale! double d1 = std::stod(s); std::cout << "d1: " << d1 << std::endl; double d2 = 2.2; std::cout << "d2: " << d2 << std::endl; std::locale loc("") creates the correct

Use boost locale together with Firebreath

女生的网名这么多〃 提交于 2019-12-11 19:16:57
问题 I create a chrome extension using Firebreath: http://slimtext.org And I meet a problem: the extension does not support Chinese characters very well on Windows. After a lot of research I found this: http://www.boost.org/doc/libs/1_50_0/libs/locale/doc/html/default_encoding_under_windows.html I think the solution is to use boost/locale. But the https://github.com/firebreath/firebreath-boost project does not seem to contain boost/locale. The 1.50.0 branch contains newer boost than the master

Is There an Upper Bound in my locale for Time Related Information?

别等时光非礼了梦想. 提交于 2019-12-11 02:39:32
问题 Is there a definition somewhere in the standard namespace that sets forward: Months in a year Days in a week Hours in a day Minutes in an hour Seconds in a minute The struct tm has contains member variables that must be in these ranges, but I can't find the defined limits anywhere. I'm not even sure if there are locales defined where these wouldn't match the conventional set (12/7/24/60/60). Even if there aren't potential users with other range limits, I'd sure like to use a define from the

Read/Write file with unicode file name with plain C++/Boost

微笑、不失礼 提交于 2019-12-05 20:03:14
问题 I want to read / write a file with a unicode file name using boost filesystem, boost locale on Windows (mingw) (should be platform independent at the end). This is my code: #include <boost/locale.hpp> #define BOOST_NO_CXX11_SCOPED_ENUMS #include <boost/filesystem.hpp> #include <boost/filesystem/fstream.hpp> namespace fs = boost::filesystem; #include <string> #include <iostream> int main() { std::locale::global(boost::locale::generator().generate("")); fs::path::imbue(std::locale()); fs::path

stod does not work correctly with boost::locale

感情迁移 提交于 2019-12-01 07:32:24
I am trying to use boost::locale and std::stod together in a german locale where a comma is the decimal separator. Consider this code: boost::locale::generator gen; std::locale loc(""); // (1) //std::locale loc = gen(""); // (2) std::locale::global(loc); std::cout.imbue(loc); std::string s = "1,1"; //float string in german locale! double d1 = std::stod(s); std::cout << "d1: " << d1 << std::endl; double d2 = 2.2; std::cout << "d2: " << d2 << std::endl; std::locale loc("") creates the correct locale and the output is d1: 1,1 d2: 2,2 as I expect. When I comment out line (1) and uncomment line (2)