Subject: Re: [boost] [nowide] Easy Unicode For Windows: Request For Comments/Preliminary Review
From: Yakov Galka (ybungalobill_at_[hidden])
Date: 2012-05-28 16:53:25
On Mon, May 28, 2012 at 3:33 PM, Artyom Beilis <artyomtnk_at_[hidden]> wrote:
> The library provides an implementation of standard C and C++ library
> functions such that their inputs are UTF-8 aware on Windows without
> requiring using Wide API to make program work on Windows.
I'm happy that this is getting to be proposed to boost.
* I find the way you handle the main() arguments elegant.
* I don't like that the convert function is overloaded for both narrow and
Rationale: Consider the following real-world scenario:
// Some existing overloaded function, like std::fstream constructor on
void f(const std::string &s); // 3rd party 'ANSI' codepage
void f(const std::wstring &s); // 3rd party 'UNICODE'
std::string str = get_utf8_string();
f(convert(str)); // we want to call the wide string version
Now during development we may change it to:
std::wstring str = get_string_from_windows(); // we changed only this
f(convert(str)); // and forgot to change this one. oops...
Solution: This is an error that can be caught at compile time, we just have
to state the intent clearly. Use alternative names? (narrow/widen)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk