-
Notifications
You must be signed in to change notification settings - Fork 163
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 html utf8 bom signature #268
add html utf8 bom signature #268
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi and thank you for your contribution.
There is a problem with current solution: it does not work when there is whitespace between BOM and HTML signature.
I added a testcase to show the problem.
I think a solution for this would be to trim the BOM here, before the trimLWS
call. Let me know if you other idea how to do it.
Hi - good catch - I'll have a look at it tomorrow and update the PR. |
@gabriel-vasile I think your proposal of trimming the BOM before trimLWS is good - I chose to skip and then restore it after stripping so its presence can be used later on if needed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, I'm not sure I understand the reason for restoring the BOM. The way I see it, trimming the BOM will always be more efficient and still detect MIME type correctly.
ensure BOM has precedence in html encoding detection add tests for BOM detection override
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, the code looks all good. Just one small issue with comments to solve before I can merge.
closes #267