Skip to content

fix: add encoding="utf-8" to plan_session_storage.py open() calls - #111

Open
realmaxc wants to merge 1 commit into
OpenNSWM-Lab:mainfrom
realmaxc:fix/plan-session-storage-encoding
Open

fix: add encoding="utf-8" to plan_session_storage.py open() calls#111
realmaxc wants to merge 1 commit into
OpenNSWM-Lab:mainfrom
realmaxc:fix/plan-session-storage-encoding

Conversation

@realmaxc

Copy link
Copy Markdown

The plan_session_storage.py file has 6 open() calls (lines 87, 95, 105, 139, 147, 154) that read and write JSON session files without specifying an encoding. On systems where the default locale is not UTF-8, plan sessions containing non-ASCII text (goal descriptions, user notes, candidate plan titles) will silently corrupt data or raise UnicodeDecodeError.

This adds encoding='"utf-8"' to all 6 calls across both PlanSessionStorage (create, get, list_all) and CandidatePlanStorage (create, get, list_by_session).

Testing: Added tests/test_pr_04_plan_session_encoding.py with 3 tests:

  • Session round-trip with Chinese user notes
  • list_all with mixed ASCII/non-ASCII notes (English, French, Chinese)
  • Candidate plan round-trip with Chinese title and abstract

All 3 tests pass in the sandbox container.

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