|
Boost : |
Subject: Re: [boost] [Locale] does generator("") deliver the system's default locale?
From: Artyom Beilis (artyomtnk_at_[hidden])
Date: 2013-07-22 07:58:26
Hello,
When the Boost.Locale is used for number formatting you need to use appropriate
manipulators
cout.imbue(locale_generated_by_boost_locale);
cout << 10.23 << " " << boost::locale::as::number << 10.23 << std::endl;
Would deliver in de_AT locale
10.23 10,23
Boost locale does not alter the basic C locale formatting such that you will always
get for decimal point "." of the "C" locale. Rationale?
http://www.boost.org/doc/libs/1_54_0/libs/locale/doc/html/std_locales.html#std_locales_common
Also it would allow to use characters like NBSP that can't be represented with a single char.
That is why you get generator("")).decimal_point() == '.'
Artyom Beilis
--------------
CppCMS - C++ Web Framework: http://cppcms.com/
CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/
----- Original Message -----
> From: Michael Schinner <Michael.Schinner_at_[hidden]>
> To: "boost_at_[hidden]" <boost_at_[hidden]>
> Cc:
> Sent: Monday, July 22, 2013 11:38 AM
> Subject: [boost] [Locale] does generator("") deliver the system's default
locale?
>
> boost 1.54.0
> When I use boost::locale::generator and generator("") I get different
> results for the decimal point than using std::locale("").
> Boths methods are supposted to deliver the system's default locale.
>
> Example:
> // windows 7, de_AT
> std::use_facet<std::numpunct<char>
>> (std::locale("")).decimal_point(); // delivers a ,
> boost::locale::generator generator;
> std::use_facet<std::numpunct<char>
>> (generator("")).decimal_point(); // delivers a .
>
> What does generator("")) deliver? Is it wanted that a '.' is
> deliverd as decimal point for a german locale?
>
> Best regards,
> Michael
>
>
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk