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

Sanitisation seems to replace valid UTF-8 when a single invalid character is present #88

Open
adamransom opened this issue Oct 22, 2024 · 1 comment
Labels

Comments

@adamransom
Copy link

I might be misunderstanding the purpose of the gem, but the README states

Re-encode it as UTF-8, replacing invalid and undefined characters as U+FFFD.

whereas it doesn't just replace invalid characters, but all UTF-8 characters. This is even more of a problem when sanitising null-bytes, as a single null-byte will wipe out all UTF-8 characters.

Expected: "Hello \xE0 World 😁" => "Hello � world 😁"
Actual: "Hello \xE0 World 😁" => "Hello � world ����"

@whitequark whitequark added the bug label Oct 22, 2024
@whitequark
Copy link
Owner

This is a bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants