commit 62b0dee148436e1b0d4669f8ae712688dbdfee8f Author: kjuulh Date: Tue Dec 16 10:54:31 2025 +0100 feat: add initial ignore unsafe utf8 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..d6c9369 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,16 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "anyhow" +version = "1.0.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" + +[[package]] +name = "fexcel" +version = "0.1.0" +dependencies = [ + "anyhow", +] diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..bf9128c --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "fexcel" +version = "0.1.0" +edition = "2024" + +[dependencies] +anyhow = "1.0.100" diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..61f777a --- /dev/null +++ b/src/main.rs @@ -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(()) +}