Sample Header Ad - 728x90

Suckless's st messes up UTF-8 sometimes

0 votes
1 answer
945 views
I wrote an echo program in Rust (which can deal with UTF-8) and occasionally st seems to mess up the UTF-8 input. I've tried different terminal emulators, like alacritty and gnome-terminal and they work fine. To reproduce this: * Run this Rust code in [st](st.suckless.org):
use std::io::BufRead;

fn main() {
    for line in std::io::stdin().lock().lines() {
        let line = line.unwrap();
        println!("{line}");
    }
}
* Input things like "Rückgängig", or other strings with non-english characters. After a while the program should fail:
thread 'main' panicked at 'called Result::unwrap() on an Err value: Error { kind: InvalidData, message: "stream did not contain valid UTF-8" }', src/main.rs:5:25
Does anyone have an idea how this could be fixed or why this happens?
Asked by weisbrja (251 rep)
Feb 21, 2022, 03:11 PM
Last activity: Jun 5, 2022, 12:37 AM