Skip to content

Console number formatting is locale-sensitive while JSON is invariant; output mismatches #1662

Description

@Widthdom

Summary

ConsoleUi formats numbers and percentages for human display using locale-sensitive defaults (:F1, :N0), so French/German/Italian users see 5,9% and 123 456 while the JSON path explicitly uses InvariantCulture and emits 5.9 and 123456. A user copy-pasting a number from console summary into a follow-up --json consumer (or mixing console and JSON in CI logs) gets inconsistent formatting that can't be reconciled without locale awareness.

Distinct from #1543 (CLI numeric flag parsing not InvariantCulture) — that is the input side; this is the output side.

Where

  • src/CodeIndex/Cli/ConsoleUi.cs:205 (PrintProgress format strings)
  • Various other :F1 / :N0 / :P format string usages across CLI runners

Suggested approach

(1) Pass CultureInfo.InvariantCulture explicitly to all human-facing format calls in CLI output (the JSON path is already correct). (2) If localization is desired, gate it on a --locale=auto opt-in flag rather than defaulting to system locale. (3) Document the policy ("CLI output uses invariant formatting") in USER_GUIDE.md.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions