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

Add option to filter out non ascii chars #4

Merged
merged 2 commits into from
Mar 25, 2023
Merged

Add option to filter out non ascii chars #4

merged 2 commits into from
Mar 25, 2023

Conversation

braunbearded
Copy link
Contributor

This will allow a user filter out non assci characters via --onlyascii flag

@edermi edermi merged commit 2e7dd28 into edermi:main Mar 25, 2023
@edermi
Copy link
Owner

edermi commented Mar 25, 2023

Hey @braunbearded, I tried to simplify your logic a little bit, you may have a look at it. I also swapped out your isASCII check with a library check provided by golang.org/x/exp/utf8string. Although your ASCII check didn't look wrong, when dealing with encodings, I think relying on a dedicated library is almost always a better approach compared to writing stuff on your own. There are too many corner cases and weird decisions you may not be aware of, therefore I hope this is fine for you.

I did some rudimentary checks, you may also have another look at it to make sure everything still works as it is supposed to.

@braunbearded
Copy link
Contributor Author

Yeah using a library in this makes sense especially when dealing with encoding.

Thanks for the feedback!

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.

2 participants