Subject: Re: [boost] [locale] Strange(?) result in example code
From: Artyom (artyomtnk_at_[hidden])
Date: 2011-04-16 09:31:43
> > > std::cout.imbue(std::locale()); // Now global locale imbued to stream as
> > LOL, DUH! OK. Thanks.
> Well join the club - I've fallen into this pit recently :-(
> Am I correct in thinking that the reason is that std::cout is constructed
> *before* the new locale is 'globalled'?
> And so std::cerr needs imbuing too but that fstream and stringstreams
> constructed after the std::locale::global("en_US.UTF-8") statement will get
> the new locale?
Yes, basically if you want to do it fully for standard library and boost:
// this is for boost filesystem
Boost list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk