Boost logo

Boost :

Subject: Re: [boost] [review] Review of Nowide (Unicode) starts today
From: Artyom Beilis (artyom.beilis_at_[hidden])
Date: 2017-06-12 17:45:44


On Mon, Jun 12, 2017 at 6:03 PM, Peter Dimov via Boost
<boost_at_[hidden]> wrote:
> Artyom Beilis wrote:
>
>> > Question: what do the functions do (on Windows) when the passed UTF-8 is
>> > > invalid? From a brief look at the documentation, I don't see this >
>> > specified, but I may have missed it.
>>
>>
>> It is documented in reference documentation.
>>
>>
>> http://cppcms.com/files/nowide/html/namespaceboost_1_1nowide.html#a6644397c539754076b11e95c535be192
>
>
> Yes, I see now that it's documented on some, such as for instance fopen:
>
> If invalid UTF-8 given, NULL is returned and errno is set to EINVAL
>
> but not all, for instance getenv:
>
> UTF-8 aware getenv. Returns 0 if the variable is not set.
>
> or setenv:
>
> UTF-8 aware setenv, key - the variable name, value is a new UTF-8 value,.
>

I try to keep interface similar to standard one. Changing errno by
getenv isn't something expected.

> and it's not clear what happens when one feeds invalid UTF-8 to cout/cerr.

Yes you are right it should be more clear. In case of invalid UTF-8
fail bit will be set.

>
> Another minor point is that the library assumes Cygwin is POSIX and tries
> `using ::setenv;`, which is a compile error. For the purposes of Nowide,
> Cygwin should be considered Windows

Not exactly.

Since Cygwin 1.7 it uses UTF-8 by default so all operations like fopen
cooperate properly with Windows API.
So it is correct to consider Cygwin as POSIX and not Windows.

Regarding specific setenv/getenv and how and if it handles
narrow/wide conversions
I indeed need to check.

Thanks,
   Artyom


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