Stefan Sperling wrote: > On Tue, Mar 03, 2015 at 04:55:01PM +0100, Thisis theone wrote: > > $ touch "árvíztűrő tükörfúrógép" > > $ ls -lah > > -rw------- 1 user user 0B Feb 8 18:20 ??rv??zt??r?? > > t??k??rf??r??g??p > > $ > > > > I am using uxterm on OpenBSD 5.6. How can my uxterm show these accents in > > this way? Why doesn't it displays it as it is? > > > > Many thanks! > > This is because ls(1) filters output with isprint(3) and is not aware > of locales (i.e. it does not call setlocale(3)). Run pkg_add colorls > and alias ls=colorls if you need multi-byte ls output.
As a shortcut, filtering out just esc will prevent most terminal damage? I'm not sure what other characters can do, though... I vageuly recall that the intersection of utf-8 and xterm controls is unknowable. poc diff: Index: util.c =================================================================== RCS file: /cvs/src/bin/ls/util.c,v retrieving revision 1.16 diff -u -p -r1.16 util.c --- util.c 21 Nov 2013 15:54:45 -0000 1.16 +++ util.c 3 Mar 2015 16:56:15 -0000 @@ -51,7 +51,7 @@ putname(char *name) int len; for (len = 0; *name; len++, name++) - putchar((!isprint((unsigned char)*name) && f_nonprint) ? '?' : *name); + putchar((*name == 0x1b && f_nonprint) ? '?' : *name); return len; }