[Toybox] [PATCH] lib/lib human_readable_long fix utf-8 LC_NUMERIC

Rob Landley rob at landley.net
Wed Sep 9 22:55:34 PDT 2020

On 9/9/20 12:36 PM, Jarno Mäkipää wrote:
> Apparently LC_NUMERIC thousands_sep can be NARROW NO-BREAK SPACE
> There might be cleaner fix than this, but copying just char out of
> thousands_sep spit out

I've fallen a bit behind on posting blog entries again (they need editing and
formatting) but I already wrote there about the reason I DIDN'T do that, which
is that the buffer it writes into is a fixed length and if you don't know how
long the output is you have to malloc it all instead which requires changing
every caller to free it again. (In theory you could calculate a maximum size but
who says there aren't COMBINING characters in your utf8 sequence?)

So no, this is not currently supported. I made it work with "," and with ".",
and if this bothers you I can update it so the test to fall back to (',' is !x
|| x>127).

At the moment, musl and bionic are both returning hardwired "" so this code only
triggers with glibc anyway.


More information about the Toybox mailing list