From: Johan Ström (johan_at_[hidden])
Date: 2007-11-12 14:02:46
On Nov 10, 2007, at 14:32 , Sebastian Redl wrote:
> Beman Dawes wrote:
>> std::locale global_loc = std::locale();
>> fs::detail::utf8_codecvt_facet utf8_facet;
>> std::locale loc( global_loc, &utf8_facet );
> Eep, don't do that!
> Facets are reference-counted. The locale adds a reference when you add
> the facet, and takes it away when it is destructed. When the count
> to zero, it tries to delete the facet.
> Either allocate the facet with new and pass it to the locale, or
> pass 1
> to its constructor so that the reference counter is initialized at
> 1 and
> never drops to zero.
Thanks guys! Now it is working fine on Linux (with LANG=en_US.utf8 at
least). I put my utf8_facet inside a shared_ptr that lives throught
my app so thats solved.
However, on OS X it still wont work, not sure why.. When I do
fs::wpath_traits::imbue( loc ); I get an
"locale::facet::_S_create_c_locale name not valid" exception.
I'm running with LANG=en_US.UTF-8 here, which (according to locale in
console) is fine.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk