On Tuesday 16 February 2016, Paul Eggert wrote: > On 02/16/2016 10:48 AM, Ruediger Meier wrote: > > If the file name _is_ readable at all, then it was printed in a > > more readable way. > > Sorry, I'm not following. What do you mean by "readable at all"?
I've ment printable should be just printed as is. Please no wrong assumptions that any user would want to copy/paste any ls output into the next shell prompt. > > Other tools > > like less, more, texteditor, webbrowser don't print non-printable > > chars. Why ls? > > If by "non-printable" you mean the character can't be displayed on > the terminal, then these other tools typically use escape sequences > to represent non-printable characters unambiguously, which is the > sort of thing that 'ls' is doing now. For example, the shell command: > printf '\3' | less > > puts a highlighted ^C on my screen. This is the same basic idea that > 'ls' is now using when it puts ''$'\003' on my screen.In both cases, > an escape sequence is being used, not merely to prevent the screen > from being trashed, but also to represent the input unambiguously. The _old_ ls did it like a text editor, only translating non-printable chars into "something". An editor which would quote any ! or ? would be insane (Editor developers help shell newbies!?). The new ls output assumes that you don't want to read file names but only want to copy/paste it to a shell. But if you need to copy/paste that filename into a text editor where you want to add this file name to C #define then you have to remove the useless shell quotes/escapes again. Maybe LANG=C should give us C-style char* output!? cu, Rudi