Skip to content

cardano-node | cardano-tracer: Consistent UTF-8 console settings - #6731

Open
mgmeier wants to merge 1 commit into
masterfrom
mkarg/fix-win-utf8
Open

mgmeier wants to merge 1 commit into
masterfrom
mkarg/fix-win-utf8

Conversation

@mgmeier

@mgmeier mgmeier commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Description

Fixes: #6711

On Windows, cardano-node wrote stdout and stderr in the system's legacy code page instead of UTF-8. This caused two problems:

  • Non-ASCII characters produced JSON trace lines that were not valid UTF-8.
  • Characters outside the code page crashed the node at startup, for example a non-ASCII host name or TraceOptionNodeName.

The same crash occurs on Linux under a non-UTF-8 locale.

This PR wraps main in withCP65001 $ withUtf8 in cardano-node, cardano-tracer and the cardano-node-test suite:

  • withUtf8 (from the with-utf8 package) makes the standard handles and the locale encoding UTF-8.
  • withCP65001 (from the code-page package) switches the Windows console code page to UTF-8 while the program runs.

In the test suite this replaces the old stdout-only hSetEncoding.

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • New tests are added if needed and existing tests are updated. These may include:
    • golden tests
    • property tests
    • roundtrip tests
    • integration tests
      See Running tests for more details
  • Any changes are noted in the CHANGELOG.md for affected package
    • cardano-node-chairman, cardano-submit-api and cardano-testnet instead need a
      changelog fragment in <package>/.changes/, because their CHANGELOG.md is generated
      from fragments at release time. Copy _TEMPLATE.yml from that directory, or run
      nix run github:input-output-hk/cardano-dev#herald -- new
  • The version bounds in .cabal files are updated
  • CI passes. See note on CI. The following CI checks are required:
    • Code is linted with hlint. See .github/workflows/check-hlint.yml to get the hlint version
    • Code is formatted with stylish-haskell. See .github/workflows/stylish-haskell.yml to get the stylish-haskell version
    • Code builds on Linux, MacOS and Windows for ghc-9.6 and ghc-9.12
  • Self-reviewed the diff

@mgmeier
mgmeier requested a review from a team as a code owner October 9, 2026 11:55
@mgmeier mgmeier changed the title cardano-node | cardano-tracer: Consistent UTF-8 consle settings cardano-node | cardano-tracer: Consistent UTF-8 console settings Oct 9, 2026
@mgmeier
mgmeier force-pushed the mkarg/fix-win-utf8 branch from fc0aa2b to b72f5f3 Compare October 9, 2026 12:19

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] - [BUG] - Windows: stdout uses the system code page, so JSON traces are not UTF-8 and unencodable characters crash the node

1 participant