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

Fix UTF-8 decoding errors #2

Merged
merged 1 commit into from
Mar 7, 2021
Merged

Fix UTF-8 decoding errors #2

merged 1 commit into from
Mar 7, 2021

Conversation

pjsier
Copy link
Member

@pjsier pjsier commented Mar 6, 2021

Closes #1. Currently any issues with UTF-8 decoding cause a panic, so this adds a fallback to from_utf8_lossy instead of calling expect

@pjsier pjsier force-pushed the fix/utf8-decoding branch from 6c4767b to 69ddbfe Compare March 6, 2021 15:50
element.content = Some(e.unescape_and_decode(&self.reader).expect("Error"))
element.content = Some(
e.unescape_and_decode(&self.reader)
.unwrap_or_else(|_| String::from_utf8_lossy(e.escaped()).to_string()),
Copy link
Member

Choose a reason for hiding this comment

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

seems reasonable!

@pjsier pjsier merged commit 270d1bd into main Mar 7, 2021
@pjsier pjsier deleted the fix/utf8-decoding branch March 7, 2021 16:08
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.

Decoding Google Maps point KMZ file ends up with a panic
2 participants