Bug 23282 – locale decimal separator unsued [dot vs comma]

Status
NEW
Severity
normal
Priority
P3
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2022-08-04T14:31:13Z
Last change time
2024-12-01T16:40:14Z
Assigned to
No Owner
Creator
kdevel
Moved to GitHub: phobos#9842 →

Comments

Comment #0 by kdevel — 2022-08-04T14:31:13Z
The slightly modified code from issue 18018 ```fmt.d import std.stdio; import core.stdc.locale; import std.string; void main () { auto p = setlocale(LC_NUMERIC, ""); writeln (p); writeln(p ? fromStringz(p) : "FAILURE"); auto lc = localeconv(); writefln("Decimal separator: '%s'", *lc.decimal_point); writefln("Thousand separator: '%s'", *lc.thousands_sep); writefln("%f", 1234567.1234); } ``` does not use the comma as decimal separator. $ dmd fmt $ LANG=de_DE.utf8 ./fmt 7401B0 de_DE.utf8 Decimal separator: ',' Thousand separator: '.' 1234567.123400 expected: 1234567,123400 or even 1.234.567,123400 I wonder if there is any way in current D how to reliably achive this*). The documentation [1] does not know decimal separators. It only mentions the word "separator" in the context of grouping. The fracional digits are always separated by a "dot". If the documentation defines the D formatting, must the output 1234567,123400 given in issue 18018 considered a bug? *) Without search/replacing . by , in the output. [1] std.format https://dlang.org/phobos/std_format.html
Comment #1 by robert.schadek — 2024-12-01T16:40:14Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/9842 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB