fix: read profile manifests as utf-8 on Windows#40
Open
kodroi wants to merge 1 commit intoverygoodplugins:mainfrom
Open
fix: read profile manifests as utf-8 on Windows#40kodroi wants to merge 1 commit intoverygoodplugins:mainfrom
kodroi wants to merge 1 commit intoverygoodplugins:mainfrom
Conversation
Closes verygoodplugins#39. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes Windows crashes when reading Stream Deck profile/page manifests containing non-ASCII (e.g., emoji) by forcing JSON reads/writes to use UTF-8 in the shared helper layer, and adds a regression test covering UTF-8 emoji content in a page manifest.
Changes:
- Read JSON manifests with
Path.read_text(encoding="utf-8")in the JSON loader. - Write JSON manifests atomically with
Path.write_text(..., encoding="utf-8"). - Add a regression test that writes a UTF-8 page manifest containing
"pastedText": "👍"and verifieslist_profiles()+read_page()can load it.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tests/test_profile_manager.py | Ensures test fixtures and new regression test write UTF-8 JSON and validates emoji survives a full load path. |
| profile_manager.py | Makes JSON load/atomic write explicitly UTF-8 to avoid Windows codepage-dependent decoding/encoding. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "AppIdentifier": "*", | ||
| "Device": {"Model": "20GBA9901", "UUID": "@(1)"}, | ||
| "Name": "UTF-8 Profile", | ||
| "Pages": {"Current": page_uuid, "Default": None, "Pages": []}, |
Comment on lines
+1389
to
+1396
| "0,0": { | ||
| "ActionID": "action-open", | ||
| "Name": "Thumbs up", | ||
| "Settings": {"pastedText": "👍"}, | ||
| "State": 0, | ||
| "States": [{}], | ||
| "UUID": "com.elgato.streamdeck.system.text", | ||
| } |
Member
|
@copilot apply changes based on the comments in this thread |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Windows profile reads now treat Stream Deck profile and page manifests as UTF-8, which stops
streamdeck_read_profilesfrom crashing when a manifest contains emoji or other non-ASCII text.The change keeps encoding decisions in the existing JSON helper layer by making manifest reads and atomic writes explicit about UTF-8 instead of inheriting the process codepage.
The regression test writes a real UTF-8 page manifest with
"pastedText": "👍"and verifies bothlist_profiles()andread_page()can load it.Closes #39.
Testing
uv run pytest tests\\test_profile_manager.py -k utf8 -quv run ruff check tests\\test_profile_manager.py profile_manager.py