Boost logo

Boost :

Subject: Re: [boost] [General] Always treat std::strings as UTF-8
From: Artyom (artyomtnk_at_[hidden])
Date: 2011-01-15 08:29:38


> >
> > namespace boost {
> > std::string utf8_to_ansi(std::string const&s);
> > std::string ansi_to_utf8(std::string const&s);
> > std::wstring utf8_to_wide(std::string const&s);
> > std::string wide_to_utf8(std::wstring const&s);
> > }
>
> ANSI doesn't really mean much.
> It's purely a windows thing.
>
> utf8_to_locale, which would take a std::locale object, would make more
> sense.
>

1. std::locale based conversion using std::codecvt facet strongly depends on
current
   implementation and this is bad point to start from.
2. These utf8_to_ansi and backwards should not be used outside windows scope,
where ANSI means
   narrow windows API (a.k.a. ANSI API)
3. Under non-windows platform that should do anything to strings and pass them
as is as

   native POSIX api is narrow and not wide.

Artyom

      


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