ls -q replaces non printable characters with '?'; I'm not sure how to
make files with non-printable characters as yet,
touch "$(printf 'foo\nbar')"
touch "this $(tput setaf 1) is red"
You can also use Control+V to enter the next character literally (tab,
CR, backspace, etc.).
all I know is this
code path works with input that does not have non-printable
characters.
It does not work for me, all characters are replaced by ? (well, except
without the -l flag, but that's because you forgot an “ent->name” on
line 357).
I think “*p++ = *n++;” on line 344 should be “*n++ = *p++;”, but that's
not the only problem. “isprintrune(r)” seems to always return 0.