uutils / uutils/coreutils

numfmt: won't do grouping in Windows OS

Open
#4,302 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

U - numfmt
Dominant language
Rust
Stars
24.1k
Forks
2k
Avg merge
1d 5h
Merged PRs (30d)
365

Description

Hi,

Many thanks for these utilities - especial thanks for the Windows binaries.

I am trying to format numbers as currency in the UK. e.g. £12,000.99

The UK pound character is a problem - so I am happy with $.

From my batch file:

cat.exe data.csv | numfmt.exe -d, --header --field=2-4 --format="$%%'.2f" >> output.txt

I think that numfmt.exe is getting the ' to trigger grouping, but it does not seem to read my locale from the operating system.

Is there a way to force a locale or an environment variable I can set somehow?

For completeness, this is how I get the UK pound sign to display in Notepad.exe:

sed.exe -i s/\$/\xA3/g output.txt

Any help welcome.

Kind Regards Gavin Holt

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Windows batch command using numfmt.exe with the --format="$%%'.2f" option and check how locale and grouping are handled. Done means identifying whether the command can honor a Windows or forced locale and confirming the behavior with a grouped currency value.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, shell
Domain
cli, localization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.