Skip to main content

gnostr_invalidstring/
lib.rs

1/// uses unsafe to postfix the string with invalid utf8 data
2#[allow(invalid_from_utf8_unchecked)]
3pub fn invalid_utf8(prefix: &str) -> String {
4    let bytes = b"\xc3\x73";
5
6    unsafe { format!("{prefix}{}", std::str::from_utf8_unchecked(bytes)) }
7}