Subject: Re: [boost] [filesystem] Version 3 of Boost.Filesystem added to trunk
From: Beman Dawes (bdawes_at_[hidden])
Date: 2010-06-04 07:11:35
On Fri, Jun 4, 2010 at 5:03 AM, Alexander Lamaison <awl03_at_[hidden]> wrote:
> On Thu, 3 Jun 2010 20:04:26 -0400, Beman Dawes wrote:
>> On Thu, Jun 3, 2010 at 6:48 PM, Alexander Lamaison <awl03_at_[hidden]> wrote:
>>> On Wed, 2 Jun 2010 11:07:34 -0400, Beman Dawes wrote:
>>>> * Any other comments or suggestions?
>>> Some code I have wraps a SFTP library that returns paths as UTF-8 strings.
>>> These need to be converted to the local code page before displaying to the
>>> user. My original plan was to typedef basic_path with a traits class of my
>>> own that I could imbue with a specific locale to do the conversion.
>>> With FSv3 the only way to do this seems to be path::imbue() which imbue
>>> *all* paths, globally. Or am I missing something?
>> Yep, there is another way. First convert the UTF-8 string to a UTF-16
>> string using software of your choice. Then construct a
>> boost::filesystem::path with the UTF-16 string as an argument.
>> Alternately, assign the UTF-16 string to a boost::filesystem::path.
> If I contruct a path directly using a UTF-8 char string, will the UTF-8 to
> UTF-16 conversion not be taken care of by codecvt?
Yes, if the path locale is UTF-8. I was assuming you were talking
about Windows, and didn't want to use path::imbue().
By the way, I completely forgot to mention class scoped_path_locale.
See path.hpp, starting about line 452.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk