[Toybox] [PATCH] main.c: fix UTF-8 on macOS.

scsijon scsijon at lamiaworks.com
Sat Dec 19 13:41:32 PST 2020


On 20/12/20 8:13 am, toybox-request at lists.landley.net wrote:
> Message: 1
> Date: Sat, 19 Dec 2020 04:42:07 -0600
> From: Rob Landley <rob at landley.net>
> To: enh <enh at google.com>
> Cc: toybox <toybox at lists.landley.net>
> Subject: Re: [Toybox] [PATCH] main.c: fix UTF-8 on macOS.
> Message-ID: <ab4d113f-e37e-1cee-7cd6-3f9e312110ff at landley.net>
> Content-Type: text/plain; charset=utf-8
>
> On 12/14/20 11:13 PM, enh wrote:
>> On Mon, Dec 14, 2020 at 8:54 PM Rob Landley wrote:
>>
>>>     On 12/14/20 7:33 PM, enh via Toybox wrote:
>>>     > Unfortunately neither "C.UTF-8" nor "UTF-8" works on *both* OSes...
>>>
>>>     Tempted to newlocale() and uselocale() to edit utf8 support into "C" myself, but
>>>     that's even LESS likely to work on macos, isn't it?
>>>
>>>     Rob
>>> actually, the attached patch (on top of the one you already committed) doing
>> exactly that does work for me on macOS. (untested on Linux though!)
> What's xlocale.h? It's not in posix and musl hasn't got it.

?part of gnu c library, most distributions usually seem to be just link 
it from locale.h, however a real version can be found at

https://sites.uclouvain.be/SystInfo/usr/include/xlocale.h.html

however i can't say it's the latest as this one is 2011.

EDIT: apparently it was supposedly removed and your suppose to use 
locale.h instead.

https://sourceware.org/ml/libc-alpha/2017-08/msg00010.html 
<https://sourceware.org/ml/libc-alpha/2017-08/msg00010.html>

The nonstandard header <xlocale.h> has been removed. Most programs should
use <locale.h> instead. If you have a specific need for the definition of
locale_t with no other declarations, please contact
libc-alpha at sourceware.org <mailto:libc-alpha at sourceware.org> and explain.


scsijon

>
> Rob



More information about the Toybox mailing list