Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

emoji in atlantic puzzle do not appear in saved .puz file #192

Open
alexdej opened this issue Jun 14, 2024 · 4 comments
Open

emoji in atlantic puzzle do not appear in saved .puz file #192

alexdej opened this issue Jun 14, 2024 · 4 comments

Comments

@alexdej
Copy link

alexdej commented Jun 14, 2024

As reported in alexdej/puzpy#30 emoji from the Atlantic daily puzzle from 2023-11-13 do not appear in the resulting .puz file. Instead it appears to have 0s which break parsing of the file and cause AcrossLite to crash. Not sure if this is an issue with xword-dl or with puz.py.

Screenshot 2024-06-13 200529
Screenshot 2024-06-13 135829
atlantic-20231113.zip

@afontenot
Copy link
Contributor

afontenot commented Jun 14, 2024

Edit: this is now outdated, see the below comment.

@afontenot
Copy link
Contributor

Incidentally, I don't see any issue here with the latest git commit of xword-dl and 0.2.4 of puzpy. Probably some change of behavior since that release is the proximate cause.

@afontenot
Copy link
Contributor

Had another look at this. Three thoughts:

  • I said above that I couldn't reproduce the issue with some specific versions, but actually I don't see any issue with your file either. The clue strings are null terminated - the emoji are not replaced by nulls. I do not see a crash with the Gnome Crosswords app, using your file. The crasher with AcrossLite is probably the result of a blank (empty string) clue, not a broken puzzle file.

  • The ideal way to fix this is probably to change xword-dl to generate 2.0 puz files by default, but even releasing the current HEAD would fix the AcrossLite issue because emoji are currently decoded to :string_representation: rather than being replaced with empty strings.

  • There appears to be no way to set the puzzle version with puzpy when creating a new puzzle. You might want to add a version argument to the initializer. When setting the version manually in xword-dl with code like the following, I can save emoji:

        puzzle = puz.Puzzle()
        puzzle.version = b'2.0'
        puzzle.fileversion = b'2.0\0'
        puzzle.encoding = 'UTF-8'

@thisisparker
Copy link
Owner

Yep, @afontenot has this right I think. The latest released version of xword-dl doesn't know what to do with emoji, because they can't be encoded with the text encoding scheme available in puz files before v2, and so if a clue contains only emoji the resulting file would get bit crashy.

I have attempted to fix that with #157 but haven't released to PyPI since then. HEAD should have it. If you encounter any issues like that with the code at HEAD I want to know about it. In the meantime, yes, I am overdue for a release!

I have to think about the implications of generating puz v2 files; my understanding is that client support is not fully there but maybe I could have it be an option somehow.

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

No branches or pull requests

3 participants