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

[FIX] Avoid index out of bounds error when escaping chars #357

Merged
merged 1 commit into from
Nov 19, 2024

Conversation

addisonbgross
Copy link
Contributor

@addisonbgross addisonbgross commented Nov 19, 2024

What is the problem?

  • When attempting to record gameplay in this Vampire Survivors Clone, an error occurs that prevents the recording from happening

What is the solution?

  • When writing our game state to JSON during gameplay recording, we get an index out of bounds error when checking if individual chars in the game state need to be escaped
  • This game uses Mandarin characters, even when you use the English language setting, and these Mandarin characters were causing the index out of bounds error
  • We solve this error by being able to check if a char needs to be escaped, and handling any standard Unicode character (ie: codes \u0000 to \uFFFF)
    • The char.MaxValue == \uFFFF

LOOM-ing

https://www.loom.com/share/e4302d036acf448f9a1bc3ae3ce42393

Copy link
Contributor

@batu batu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fascinating

@addisonbgross addisonbgross merged commit 8f86b96 into main Nov 19, 2024
2 checks passed
@addisonbgross addisonbgross deleted the addison/handle_mandarin_json_string_writing branch November 19, 2024 21:14
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.

3 participants