On 18/10/2025 22:05, Collin Funk wrote:
Pádraig Brady <[email protected]> writes:
There were various other multi-byte blanks issues,
and multi-byte issues in general when I looked further.
The attached 3 further patches should make numfmt fully support multi-byte.
numfmt is a nice case where we don't need to optimize MB_CUR_MAX == 1,
thanks.
I can't build without this change though, because of a missing
declaration:
diff --git a/src/numfmt.c b/src/numfmt.c
index 57807e3f0..02925d802 100644
--- a/src/numfmt.c
+++ b/src/numfmt.c
@@ -1310,6 +1310,12 @@ print_padded_number (intmax_t padding)
fputs (format_str_suffix, stdout);
}
+static bool
+newline_or_blank (mcel_t g)
+{
+ return g.ch == '\n' || c32isblank (g.ch);
+}
+
/* Converts the TEXT number string to the requested representation,
and handles automatic suffix addition. */
static int
@@ -1356,12 +1362,6 @@ process_suffixed_number (char *text, long double *result,
return (e == SSE_OK || e == SSE_OK_PRECISION_LOSS);
}
-static bool
-newline_or_blank (mcel_t g)
-{
- return g.ch == '\n' || c32isblank (g.ch);
-}
-
/* Return a pointer to the beginning of the next field in line.
The line pointer is moved to the end of the next field. */
static char*
Ugh sorry, I may have tweaked earlier patches and forgotten.
Full patch set is at http://pixelbeat.org/cu/numfmt-mb/
Also, I get this failure:
lcl-suf-8...
numfmt.pl: test lcl-suf-8 failed: exit status mismatch: expected 0, got 2
From command line, that works here:
LC_ALL=fr_FR.UTF-8 src/numfmt -d '' --from=auto $'2Ki\xe2\x80\x83 '
2048
cheers,
Padraig