Boost logo

Boost :

Subject: Re: [boost] boost filesystem path as utf-8?
From: Yakov Galka (ybungalobill_at_[hidden])
Date: 2012-01-23 04:46:33


As Artyom said you can imbue whatever locale you want to specify the
conversion form narrow to wide strings. It will make almost all the
conversions transparent, except that the path will still be stored as
UTF-16 on windows. Unfortunately it boils to the interface whence you can
get a c_str() to a UTF-16 string only.

You may want to revert to Boost.Filesystem.v2 (afaik removed completely in
1.48 so you'll need to merge from the old release), it is better designed
in the sense that it has a templatized basic_path that allows you to store
utf-8 encoding internally (once you imbue the correct locale) and convert
to UTF-16 on demand.

On Mon, Jan 23, 2012 at 10:33, Artyom Beilis <artyomtnk_at_[hidden]> wrote:

> When you are using Boost.FileSystem.v3 you can imbue
> a locale with UTF-8 codecvt facet globally using.
>
> boost::path::imbue()
>
> Note path::imbue is static member function.
>
>
> Artyom Beilis
> --------------
> CppCMS - C++ Web Framework: http://cppcms.sf.net/
> CppDB - C++ SQL Connectivity: http://cppcms.sf.net/sql/cppdb/
>
>
> ----- Original Message -----
> > From: Emil Dotchevski <emildotchevski_at_[hidden]>
> > To: boost_at_[hidden]
> > Cc:
> > Sent: Monday, January 23, 2012 10:15 AM
> > Subject: [boost] boost filesystem path as utf-8?
> >
> > Hello,
> >
> > I understand that the path class .native() member function's return type
> > differs depending on the platform (wstring on windows, for example.) Is
> > there a way to get the path as a utf-8 string regardless of the platform?
> > Likewise, is there a way to construct a path object from a utf-8 string
> > regardless of the platform?
> >
> > Emil Dotchevski
> > Reverge Studios, Inc.
> > http://www.revergestudios.com/reblog/index.php?n=ReCode
> >
> > _______________________________________________
> > Unsubscribe & other changes:
> > http://lists.boost.org/mailman/listinfo.cgi/boost
> >
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>

-- 
Yakov

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