File tree Expand file tree Collapse file tree
src/test/java/io/github/easy4j/codex/cli Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -101,6 +101,19 @@ void shouldPassArgumentsRawWithoutEmbeddedQuotes() {
101101 "multi-word arguments must arrive without embedded literal quotes" );
102102 }
103103
104+ @ Test
105+ void shouldDecodeChildOutputAsUtf8 () {
106+ // The CLIs emit UTF-8 regardless of platform; decoding with the
107+ // platform default charset would mojibake on GBK-default Windows.
108+ // You = \344\275\240, Hao = \345\245\275 (POSIX printf octal escapes).
109+ CodexCliExecutor executor = new CodexCliExecutor (configFor ("/bin/sh" ));
110+
111+ CodexCliResult result = executor .executeWithStdin (null , "-c" , "printf '\\ 344\\ 275\\ 240\\ 345\\ 245\\ 275'" );
112+
113+ assertEquals ("你好" , result .getStdout (),
114+ "child output must be decoded as UTF-8, not the platform default charset" );
115+ }
116+
104117 @ Test
105118 void shouldIgnoreNullArguments () {
106119 CodexCliExecutor executor = new CodexCliExecutor (configFor ("/bin/echo" ));
You can’t perform that action at this time.
0 commit comments