You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] echo -e prints \xHH, \e and \uHHHH literally and writes \0NNN bytes above 0177 as Latin-1 #336
\033 and the other ASCII octal escapes are correct. Colour codes written as \e[31m or \x1b[31m come out as literal text.
Additional Context
Found while testing #326. expand_escapes in src/builtins/echo.rs:55 has no arm for x, e or u, and pushes an octal value as a char (src/builtins/echo.rs:87 at 2a1495e):
out.push(val aschar);
which turns each byte above 0177 into a two-byte UTF-8 character. This is the same Latin-1 pattern as #255.
Possible Solution
Reuse the escape decoder printf got in #215 (escape in src/builtins/printf.rs:387), which writes raw bytes and handles \x and \u. It has no \e either: printf 'A\e[0mB\n' also prints \e literally where bash prints ESC, so \e needs adding for both.
Activity