Boost logo

Boost :

Subject: [boost] [1.44] [filesystem] how to imbue utf-8
From: Jochen Wilhelmy (j.wilhelmy_at_[hidden])
Date: 2010-08-23 10:30:55


With boost::filesystem I'd like to do the following:
- use std::string (i.e. 8 bit) with utf-8
- call native functions such as CreateFileW(), or open()
on windows, linux and macos

the v3 version handles this differently than v2 and maybe the new
approach of
v3 is indeed better since I can imbue utf-8 and all other libs that I
use that use
boost::filesystem will magically also use utf-8 which was not possible
with the v2 version.

But now my questions:
How do I imbue utf-8? Maybe a newbee-question but would be nice if it
would appear in
a tutorial.

How do I get a wchar_t* for CreateFileW()?
How to I get a utf-8 encodec char* for open() for macos?
How to I get a locale-encoded char* for open() for linux?
(the locale may be utf-8 but if it is latin-1 then a transcoding has
to take place).

The generic constructor of fs::path should be made explicit since it
makes overloading difficult.
Of course constructors for std::basic_string, char*, wchar_t* etc. can
be implicit.


Boost list run by bdawes at, gregod at, cpdaniel at, john at