Subject: Re: [boost] [general] What will string handling in C++ look like in the future [was Always treat ... ]
From: Peter Dimov (pdimov_at_[hidden])
Date: 2011-01-20 19:00:23
Beman Dawes wrote:
> Why not just use Boost.Filesystem V3 for dealing with files and filenames?
> Your code can be written to be reasonably portable too, particularly if
> all you are concerned with is either Windows systems or POSIX-like systems
> that use utf-8 for filenames. If you want wider portability, you would
> have to avoid narrow strings so that on POSIX-like systems the wide
> strings could be converted to whatever narrow encoding the system uses.
No, if you want wider portability you want to avoid wide strings and use
narrow strings (UTF-8 on Windows, no conversion on POSIX). You don't want to
convert on POSIX because the narrow -> wide -> narrow conversion may not be
exact. (*) On Windows, wide (UTF-16) -> narrow (UTF-8) -> wide (UTF-16) is
std::wstring is typically UTF-32 on POSIX, by the way, because wchar_t is 32
bits there - this is one additional source of non-portability if you go
(*) It will be exact if you use a single-byte encoding that maps every
narrow character to a distinct Unicode code point, but then you can't use
UTF-8 at the same time - you have to choose one or the other.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk