Skip to content

Fix save/load encoding mismatch#2

Open
didgogns wants to merge 1 commit into
ducdat0507:mainfrom
didgogns:devin/1777508152-fix-save-load-encoding
Open

Fix save/load encoding mismatch#2
didgogns wants to merge 1 commit into
ducdat0507:mainfrom
didgogns:devin/1777508152-fix-save-load-encoding

Conversation

@didgogns
Copy link
Copy Markdown

The save() function encodes with btoa(unescape(encodeURIComponent(...))), but load() was decoding with only JSON.parse(atob(...)), missing the reverse decodeURIComponent(escape(...)) step. This caused non-ASCII characters (like the × in the giftcode hunter multiplier message) to corrupt and double in size on every page load, producing garbled ÃÂÃÂ... strings that grew indefinitely.

The fix adds decodeURIComponent(escape(...)) to match the save encoding, consistent with how loadOptions() already correctly handles this.

…tely

The save() function encodes with btoa(unescape(encodeURIComponent(...))), but
load() was decoding with only JSON.parse(atob(...)), missing the reverse
decodeURIComponent(escape(...)) step. This caused non-ASCII characters (like
the × in the giftcode hunter multiplier message) to corrupt and double in size
on every page load, producing garbled ÃÂÃÂ... strings that grew indefinitely.

The fix adds decodeURIComponent(escape(...)) to match the save encoding,
consistent with how loadOptions() already correctly handles this.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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