Skip to content

Commit 0d707e5

Browse files
committed
fix(man): fix groff UTF-8 handling and strip ANSI escapes
Add `-K utf8` to handle UTF-8 input correctly (fixes mojibake in non-ASCII characters like © and Vietnamese names) and `-P -c` to disable SGR escape sequences in the output. https://claude.ai/code/session_01CrXuWDMVQsiUBoy6ceACsF
1 parent ae6b848 commit 0d707e5

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

cli/man_page.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,17 @@ fn man_path(page_num: u8) -> String {
6262
fn render_man_output(page_num: u8) -> Result<String, String> {
6363
let roff_file = roff_path(page_num);
6464
let output = Command::new("groff")
65-
.args(["-man", "-T", "utf8", "-r", &format!("LL={LINE_LENGTH}n")])
65+
.args([
66+
"-man",
67+
"-T",
68+
"utf8",
69+
"-K",
70+
"utf8",
71+
"-P",
72+
"-c",
73+
"-r",
74+
&format!("LL={LINE_LENGTH}n"),
75+
])
6676
.arg(format!("./{roff_file}"))
6777
.output()
6878
.map_err(|error| format!("failed to run groff: {error}"))?;

0 commit comments

Comments
 (0)