Boost logo

Boost :

Subject: Re: [boost] wfopen
From: Jeremy Maitin-Shepard (jeremy_at_[hidden])
Date: 2010-12-13 19:32:35


On 12/12/2010 05:58 PM, Christian Henning wrote:
> Hi there, one of the requirements for me to fix before I include
> io_new to boost is to support opening files with unicode filenames. As
> far as I can see there is _wfopen on Windows platforms. What's the one
> for Linux and co?
>
> I'm a bit puzzled that no boost lib seems to use _wfopen. I searched
> all files. Is there something better?

I believe that on Linux and other Unix-like platforms, no one attempts
to use wchar_t strings to specify paths, and has been noted, officially
on Linux path components are just strings of bytes with '/' and '\0'
excluded, with no defined encoding (although nowadays it would be
unlikely to not use UTF-8). In fact, I believe whcar_t and associated
facilities in C/C++ are not very widely used on Linux at all. I believe
the most useful behavior when passed a string of char as a path name is
to use that path name directly (and not support wchar_t string path
names); attempting to do any conversion, such as converting from the
current locale to UTF-8 if the current locale is not UTF-8, would likely
only be counter-productive, as nowadays it is most common for the
current locale to be UTF-8 anyway, and if it is not, there is a good
chance the filesystem also contains paths encoded according to the
current locale rather than UTF-8.


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