[Toybox] [PATCH] Fix setlocale() calls on macOS.

Rob Landley rob at landley.net
Fri Dec 11 17:57:34 PST 2020


On 12/11/20 5:00 PM, enh via Toybox wrote:
> This reverts part of 75b89012c90470a27d66b54ad89901b94fcfd169.
> Always supporting UTF-8 is a good idea, but you need to be careful
> how you try to do that on macOS. The previous comment obviously
> didn't suffice to make that clear, so I've been a bit more verbose
> this time.
> 
> This fixes multiple existing tests.

If they choose a non-utf8 locale, how does... ah, my test is backwards:

  if (!strcmp("UTF-8", nl_langinfo(CODESET)))

That should be if (strcmp) so then if nl_langinfo(CODESET) does NOT return UTF-8
we fall back to C.UTF-8. (The intent is to try the current locale, check to
confirm it's UTF-8, and fall back to C.UTF-8 if it is not.)

Try now?

(My concern is if they chose a locale with strange case conversion semantics, I
want to honor those because there are some unicode case conversions in the code
that we should get right for the locale.)

Rob



More information about the Toybox mailing list