Fix Unicode in string decoding#22
Open
darthwalsh wants to merge 2 commits intodownforacross:masterfrom
Open
Conversation
Current code works only for ASCII, but creates garbled bytes for any unicode. Today with e.g. https://www.nytimes.com/crosswords/game/daily/2025/07/13 64 Across should be: "Phrase cooed en español" But with the bug it shows: "Phrase cooed en español" My PUZ file worked fine at https://squares.io/s/jy5a5wyg
darthwalsh
added a commit
to darthwalsh/CrossWordy
that referenced
this pull request
Jul 24, 2025
Using jsdelivr github CDN until downforacross/puzjs#22 is merged
Author
|
|
Validation: Correctly parses both: - BrandonKoppyWillShortz-NYTimesSundayJuly132025TunnelVision.puz - DerrickNiedermanWillShortz-NYTimesSundaySeptember72025TheNameIsTheGame.puz
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.
Current code works only for ASCII, but creates garbled bytes for any unicode.
Use
TextDecoderandTextEncoderwhich are broadly supported: "Baseline Widely available."Sniff the copyright string to determine correct encoding when decoding.
For some more context, I asked ChatGPT to explain what was wrong.
Validation
With e.g. https://www.nytimes.com/crosswords/game/daily/2025/07/13
64 Across should be: "Phrase cooed en español"
But with the bug puzjs returns: "Phrase cooed en español"
My PUZ file worked fine at https://squares.io/s/jy5a5wyg
Now correctly parses both:
- BrandonKoppyWillShortz-NYTimesSundayJuly132025TunnelVision.puz
- DerrickNiedermanWillShortz-NYTimesSundaySeptember72025TheNameIsTheGame.puz