https://issues.dlang.org/show_bug.cgi?id=20069
shove <shove@163.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |shove@163.com
--- Comment #1 from shove <shove@163.com> ---
(In reply to asumface from comment #0)
> Currently the default separator used by std.format is always ','.
> With the C locale (default) the number 123456.789 is thus formatted as
> "123,456.789,000".
> If another locale is activated, the output does not match the locale and
> sometimes even becomes a mess:
> writefln("%,f", 123456.789)
> de_DE.UTF-8: "1,234,56,,789,000"
> fr_FR.UTF-8: "1,234,56,,789,000"
> fr_CH.UTF-8: "123,456.789,000"
> en_IN.UTF-8: "123,456.789,000"
> nl_NL.UTF-8: "1,234,56,,789,000"
> hak_TW: "123,456.789,000"
> ps_AF: "12,345,6٫,789,000"
> unm_US: "123,456.789,000"
>
> The printf as defined by POSIX formats the same case as follows (I'd regard
> this as the generally correct formatting):
> printf("%'f", 123456.789)
> C: "123456.789000"
> de_DE.UTF-8: "123.456,789000"
> fr_FR.UTF-8: "123 456,789000"
> fr_CH.UTF-8: "123'456.789000"
> en_IN.UTF-8: "1,23,456.789000" (non-uniform group size!)
> nl_NL.UTF-8: "123456,789000"
> hak_TW: "12,3456.789000"
> ps_AF: "123٬456٫789000"
> unm_US: "12 34 56.789000"
>
> Grouping after the decimal separator should probably be made optional as it kind of is nonstandard behavior (scanf doesn't appear to handle such grouping, for example) yet useful for human interfacing nonetheless. Grouping should, unless overridden, behave according to the active locale, for the C locale, which is active by default, this means no grouping at all. This is useful because a formatted number such as 100000 is otherwise ambiguous for comma-decimal-users by default ("100,000").
In dealing with issue 20064, I also noticed the problems. I'll handle it together.
--
|