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

Handle invalid UTF-8 and "DEL" ASCII code #140

Merged
merged 2 commits into from
Oct 2, 2024

Conversation

mk-mxp
Copy link
Contributor

@mk-mxp mk-mxp commented Oct 1, 2024

Closes #139

In user output, e.g. for debugging, and in test failure messages there may be invalid UTF-8 or an ASCII DEL character.

Invalid UTF-8 stopped PHP from producing JSON completely. This was found while working on Rotational Cipher, where ASCII characters are rotated and might result in invalid UTF-8.

ASCII DEL character was also produced during that exercise and resulted in wrongly displayed output vs. JSON. PHPUnit detects ASCII control chars and turns output to "binary string" - but not for invisible DEL character (0x7F), which consumes the following character on screen.

In user output, e.g. for debugging, and in test failure messages there
may be invalid UTF-8 or an ASCII DEL character.

Invalid UTF-8 stopped PHP from producing JSON completely. This was found
while working on Rotational Cipher, where ASCII characters are rotated
and might result in invalid UTF-8.

ASCII DEL character was also produced during that exercise and resulted
in wrongly displayed output vs. JSON. PHPUnit detects ASCII control
chars and turns output to "binary string" - but not for invisible DEL
character (0x7F), which consumes the following character on screen.
@mk-mxp mk-mxp self-assigned this Oct 1, 2024
@mk-mxp mk-mxp requested a review from homersimpsons October 1, 2024 14:29
Copy link

@homersimpsons homersimpsons left a comment

Choose a reason for hiding this comment

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

Nice catch and probably nice investigation!

src/Result.php Show resolved Hide resolved
src/Tracer.php Outdated Show resolved Hide resolved
@mk-mxp mk-mxp requested a review from homersimpsons October 2, 2024 07:33
@mk-mxp mk-mxp merged commit 8b3c1b8 into exercism:main Oct 2, 2024
1 check passed
@mk-mxp mk-mxp deleted the handle-invalid-utf8 branch October 2, 2024 11:41
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.

Solution crashes Exercism testing
2 participants