Closed fabioanderegg closed 3 years ago
When viewing a page that contains invalid UTF-8, I get the following error in the log file:
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: Utf8Error { valid_up_to: 3077, error_len: Some(1) }', src/main.rs:417:69
My fix replaces invalid data with the �, see documentation here: https://doc.rust-lang.org/std/string/struct.String.html#method.from_utf8_lossy
nice catch. It would be great if u could add a unittest for that :)
I updated the pull request with a test case. Not too familiar with Rust yet, not sure if it's possible to create the string without unsafe.
When viewing a page that contains invalid UTF-8, I get the following error in the log file:
My fix replaces invalid data with the �, see documentation here: https://doc.rust-lang.org/std/string/struct.String.html#method.from_utf8_lossy