Subject: Re: [boost] boost filesystem path as utf-8?
From: Beman Dawes (bdawes_at_[hidden])
Date: 2012-01-23 18:41:32
On Mon, Jan 23, 2012 at 5:15 PM, Emil Dotchevski
> How exactly do I imbue UTF-8 codecvt in a path? I Googled around and
> couldn't find anything.
There are two approaches:
* If you always want all class path arguments and returned values with
a value type of char to be treated as being UTF-8 encoded, and aren't
worried about changing a potentially dangerous global, then do this:
std::locale global_loc = std::locale();
std::locale loc(global_loc, new
* If you only want one specific path to treat its narrow character
arguments and returns as UTF-8, do this:
p.assign(u8"...", utf8); // many other path functions can take a
codecvt argument, too
By the way, you can use a UTF-8 codecvt facet from someone else if you prefer.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk