On Sun, Apr 17, 2016 at 11:40 PM, Paul Eggert <egg...@cs.ucla.edu> wrote:
> Jim Meyering wrote:
>>
>> Conclusion: we'll have to make btowc work properly in the C locale, too.
>
>
> Perhaps something like the attached (untested) patch? The basic idea is to
> have btowc and mbtowc use a fixed mbrtowc if the latter has the C-locale
> problem in question. While we're at it, btowc should invoke mbrtowc not
> mbtowc, as btowc is thread-safe but mbtowc is not.

Thanks for the quick patch.
I'm sure you intended this additional change, so
that the if-expression can sometimes be false:

+      if (mbrtowc (&wc, buf, 1, &mbs) >= 0)
-       if (mbrtowc (&wc, buf, 1, &mbs) < (size_t)-2)

with that, the btowc replacement function still
declares bytes 128..255 to be invalid in the C
locale.



Reply via email to