utf-8 still not working?

Erik Wikström erik-wikstrom at telia.com
Sat May 7 06:17:03 PDT 2005


Spearow wrote:
is utf-8 encoding expected to work for commands such as 
> "ls" anytime soon? multibyte chars still show up as ?'s
> unless the "-w" option is used, which isn't desirable. see
> the following url to see what i mean.
http://diablogod.com/001.png
Have not tested it myself since I'm still running an old
Preview, but this patch changes the default behaviour from
ls -Cq to ls -C when stdout is a tty, which should give the
same result as ls -w. Is this the right way to fix this?
--
Erik Wikström

Index: ls.1
===================================================================
RCS file: /home/dcvs/src/bin/ls/ls.1,v
retrieving revision 1.2
diff -u -r1.2 ls.1
--- ls.1	17 Jun 2003 04:22:50 -0000	1.2
+++ ls.1	7 May 2005 12:57:42 -0000
@@ -209,8 +209,7 @@
 .It Fl q
 Force printing of non-graphic characters in file names as
 the character
-.Ql \&? ;
-this is the default when output is to a terminal.
+.Ql \&? .
 .It Fl r
 Reverse the order of the sort to get reverse
 lexicographical order or the oldest entries first.
@@ -234,9 +233,8 @@
 or printing
 .Pq Fl l .
 .It Fl w
-Force raw printing of non-printable characters.
-This is the default
-when output is not to a terminal.
+Force raw printing of non-printable characters,
+this is the default.
 .It Fl x
 The same as
 .Fl C ,
Index: ls.c
===================================================================
RCS file: /home/dcvs/src/bin/ls/ls.c,v
retrieving revision 1.6
diff -u -r1.6 ls.c
--- ls.c	7 Nov 2004 20:54:51 -0000	1.6
+++ ls.c	7 May 2005 12:56:55 -0000
@@ -135,7 +135,7 @@
 
 	setlocale(LC_ALL, "");
 
-	/* Terminal defaults to -Cq, non-terminal defaults to -1. */
+	/* Terminal defaults to -C, non-terminal defaults to -1. */
 	if (isatty(STDOUT_FILENO)) {
 		termwidth = 80;
 		if ((p = getenv("COLUMNS")) != NULL && *p != '\0')
@@ -143,7 +143,6 @@
 		else if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &win) != -1 &&
 		    win.ws_col > 0)
 			termwidth = win.ws_col;
-		f_nonprint = 1;
 	} else {
 		f_singlecol = 1;
 		/* retrieve environment variable, in case of explicit -C */




More information about the Submit mailing list