-
Notifications
You must be signed in to change notification settings - Fork 39
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 <meta charset> with single quotes #152
Conversation
Codecov Report
@@ Coverage Diff @@
## master #152 +/- ##
==========================================
+ Coverage 62.62% 64.58% +1.96%
==========================================
Files 17 17
Lines 610 624 +14
==========================================
+ Hits 382 403 +21
+ Misses 228 221 -7
|
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.
Could you add tests for this? Thanks!
I'm unsure how to do this... The tests don't fail on the warn message, and suckit seems to scrape |
@lhvy Here's a test if you want to add it to the #[test]
fn test_charset_parsing() {
assert_eq!(Scraper::find_charset("<meta charset=\"UTF-8\">".as_bytes(), None), Some(String::from("utf-8")));
assert_eq!(Scraper::find_charset("<meta charset='UTF-8'>".as_bytes(), None), Some(String::from("utf-8")));
} This just checks that the function returns the correct charset whether the value is between double quotes or single quotes |
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.
Thanks!
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.
Great work, thanks !
Resolves #144 with a small change to the regex to account for single or double quotes