Boost logo

Boost :

From: John Maddock (john_at_[hidden])
Date: 2004-08-25 05:50:04


> Win32 doesn't support UTF-8 filenames natively. That's why
> boost::filesystem would have to convert t o/from UCS-2 along Win32
> interface boundaries.
> If you're concerned about other platforms, you shouldn't be.
> boost::filesystem currently works only with latin encodings in ascii
> strings so no functionality would be taken away.

Not true: currently the narrow character strings passed to boost.filefsystem
are assumed to be in that platforms native encoding - you can for example
pass native Windows narrow character strings (not just ACSII ones) to the
lib, and actually I don't see why you can't pass UTF-8 on Linux. What you
can't do is use the same encoding on all platforms, because the underlying
platform API's won't understand them.

Heres my (non-portable) test code BTW:

namespace fs = boost::filesystem;

int _tmain(int argc, _TCHAR* argv[])
{
const char* name = "étrange.txt";
fs::path p(name, fs::native);

fs::ofstream os(p);
os << "Ha! Ha! Ha!";
os.close();

assert(fs::exists(p));
assert(!fs::is_directory(p));
assert(!fs::is_empty(p));
assert(fs::file_size(p));
assert(fs::remove(p));
return 0;
}

John.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk