id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	blockedby	blocking	branch_state	votes
3883	size_trunc_sep() breaks on non-ASCII locales	slyfox	andrew_b	"When mc is ran on ru_RU.UTF-8 locale it renders incorrectly
summary of file sizes for selected files:
{{{
2,478,873,80 ,К�,�Б в 1 файле
}}}

That happens because https://midnight-commander.org/browser/lib/util.c#L386
does not account for non-ASCII symbols and prepaturely stops skipping non-numeric leftover:
{{{
386	    while (p >= y && (isalpha ((unsigned char) *p) || (unsigned char) *p == ' '))
387	        *d-- = *p--;
}}}

The following workaround makes rendering work again:

{{{
diff --git a/lib/util.c b/lib/util.c
index 0326f65e8..8cf6ab6a9 100644
--- a/lib/util.c
+++ b/lib/util.c
@@ -385,3 +385,3 @@ size_trunc_sep (uintmax_t size, gboolean use_si)
     *d-- = '\0';
-    while (p >= y && (isalpha ((unsigned char) *p) || (unsigned char) *p == ' '))
+    while (p >= y && (isalpha ((unsigned char) *p) || (unsigned char) *p == ' ') || (((unsigned char) *p & 0x80) == 0x80))
         *d-- = *p--;
}}}"	defect	closed	major	4.8.21	mc-core	4.8.20	fixed					merged	committed-master
