Skip to main content

sanitize_for_terminal

Function sanitize_for_terminal 

Source
pub fn sanitize_for_terminal(text: &str) -> String
Expand description

Makes untrusted text safe to print: control characters other than \n and \t (ESC, CR, BEL, C1 controls, …) are replaced by their visible \u{…} escape, so they cannot drive the terminal (cursor moves, OSC 52 clipboard writes, title changes, overwriting lines).