feat: add initial ignore unsafe utf8
This commit is contained in:
20
src/main.rs
Normal file
20
src/main.rs
Normal file
@@ -0,0 +1,20 @@
|
||||
use std::io::{Read, Write};
|
||||
|
||||
use anyhow::Context;
|
||||
|
||||
fn main() -> anyhow::Result<()> {
|
||||
let mut input = std::io::stdin().lock();
|
||||
let mut output = std::io::stdout().lock();
|
||||
|
||||
let mut output_bytes = Vec::new();
|
||||
input
|
||||
.read_to_end(&mut output_bytes)
|
||||
.context("could not read stdin")?;
|
||||
|
||||
let safe_utf8_content = String::from_utf8_lossy(&output_bytes);
|
||||
|
||||
output.write_all(safe_utf8_content.as_bytes())?;
|
||||
output.flush()?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user