|
Boost Users : |
Subject: Re: [Boost-users] boost::filesystem::path in UTF-8 on Windows
From: John M. Dlugosz (mpbecey7gu_at_[hidden])
Date: 2011-11-05 12:43:21
On Fri, Nov 4, 2011 at 11:28, Igor R <boost.lists_at_[hidden]> wrote:
>>> On Windows you should convert it to utf16.
I know that is how it stores it internally.
My question is "how". Given that I have data that are file names and encoded in UTF-8,
how do I make the Boost path class accept them, and operate conveniently enough to be
worth using instead of plain strings?
On Fri, Nov 4, 2011 at 22:54, Andrey Moshbear <andrey.vul_at_[hidden]> wrote:
> For my rewrite of UTF-8 to UTF-16/32, look at
> https://github.com/moshbear/fastcgipp/blob/master/src/utf8_cvt.cpp.
So this is a codecvt that I should use as the extra argument, that works better than the
undocumented one that came with Boost?
And, the implicit answer is that this is indeed how I do it?
But:
1) When I write something like
path p2= p1 / "Foo" / s1 / name;
there is no place to pass the extra codecvt argument. I thought it might take strings and
keep the existing encoding, but it actually uses the default code page. How can I use
path in a simple and convenient manner given that in this program all the strings I will
use with it are already in UTF-8?
2) How can I write a line like:
path p2 (somestring, codecvt());
in a portable manner? On the Mac the internal representation is char, so will it object
to having the codecvt passed? Once I set things up, I want the bulk of the source code to
be the same on all platforms, so writing the argument on Windows and leaving it out on Mac
is not acceptable.
Thanks,
--John
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net