Skip to content

fix: Windows crash on startup — missing UTF-8 encoding for history.jsonl#5

Closed
ashleyleslie1 wants to merge 1 commit into
zihenghe04:masterfrom
ashleyleslie1:fix/windows-encoding-crash
Closed

fix: Windows crash on startup — missing UTF-8 encoding for history.jsonl#5
ashleyleslie1 wants to merge 1 commit into
zihenghe04:masterfrom
ashleyleslie1:fix/windows-encoding-crash

Conversation

@ashleyleslie1

Copy link
Copy Markdown
Contributor

Summary

  • open(HISTORY_FILE) on line 4527 crashes on Windows with UnicodeDecodeError because Python defaults to cp1252 instead of UTF-8
  • Added encoding='utf-8', errors='replace' to match the pattern already used throughout the rest of server.py

Steps to reproduce

  1. Install CCDash on Windows
  2. Run python server.py
  3. Crash: UnicodeEncodeError: 'charmap' codec can't encode characters in position 2-5

Fix

One-line change — consistent with how all other open() calls in server.py already handle JSONL files.

Test plan

  • Verified CCDash starts and serves dashboard on Windows 11 + Python 3.13.7
  • Confirmed /api/overview returns correct data after fix

On Windows, Python defaults to the system encoding (cp1252) when opening
files without an explicit encoding parameter. Since Claude Code writes
history.jsonl as UTF-8, this causes a UnicodeDecodeError on startup:

  UnicodeEncodeError: 'charmap' codec can't encode characters

This matches the encoding pattern already used throughout the rest of
server.py for JSONL file reads.
ashleyleslie1 added a commit to ashleyleslie1/CCDash that referenced this pull request Apr 5, 2026
…n re-renders

- Force UTF-8 stdout/stderr at startup for Windows compatibility
- Include open(HISTORY_FILE) encoding fix from PR zihenghe04#5
- Add tooltip theme to all ApexCharts instances (fixes white-on-white in dark mode)
- Re-render report, git stats, MCP stats, tools on language toggle
- Translate hardcoded 'msgs' and '/day' strings
@ashleyleslie1

Copy link
Copy Markdown
Contributor Author

Fix also included in PR 6, so will close this PR.

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.

1 participant