From owner-svn-src-head@freebsd.org Mon Jul 2 09:30:39 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 87BDEFF1371; Mon, 2 Jul 2018 09:30:39 +0000 (UTC) (envelope-from daichigoto@icloud.com) Received: from mr22p34im-asmtp002.me.com (mr22p34im-asmtp002.me.com [17.111.211.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 29A417D9EE; Mon, 2 Jul 2018 09:30:39 +0000 (UTC) (envelope-from daichigoto@icloud.com) Received: from process-dkim-sign-daemon.mr22p34im-asmtp002.me.com by mr22p34im-asmtp002.me.com (Oracle Communications Messaging Server 8.0.1.2.20170607 64bit (built Jun 7 2017)) id <0PB800L00CN5NQ00@mr22p34im-asmtp002.me.com>; Mon, 02 Jul 2018 08:30:32 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=04042017; t=1530520232; bh=6EqxRwMfSRmlmojGmdOcdX0QDLx4wi1OJ38FpQc46YY=; h=Content-type:MIME-version:Subject:From:Date:Message-id:To; b=snGRhKxulsqIAwwdZGK+j9oo9yZ8PsUlZgTA++5wiWt4VOnPQGYT8I/Ono5ll8EGi a68MVsVUEQRzROUhLNIjasSi5v8HV7ATwx4uq2MIpPDV+TJf+ssDVGtW06E8OMl+8X myJCigJtt9lRuUqyUzQoWlNjLc/5w18M3WyZF0dsJJ9PzyKvPNhwF9XEhNrX5SV6Cm Xv4XlvbF4T/x8aGxINKUeq29i4xDksbCDsFi4RacUNRh5kzNxNn7uQ/cmnxDhVGYkg G9ydDMGX86/O2HvXfO8UPj0yE3aUxz6nFb8MShoDe7Z5SZ462FSjwFT1ts3D1/x7IF Ikj8d1CUyW6+g== Received: from icloud.com ([127.0.0.1]) by mr22p34im-asmtp002.me.com (Oracle Communications Messaging Server 8.0.1.2.20170607 64bit (built Jun 7 2017)) with ESMTPSA id <0PB800IHJCYPNE20@mr22p34im-asmtp002.me.com>; Mon, 02 Jul 2018 08:30:31 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-07-02_01:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1011 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1807020100 Content-type: text/plain; charset=utf-8 MIME-version: 1.0 (Mac OS X Mail 11.3 \(3445.6.18\)) Subject: Re: svn commit: r335836 - head/usr.bin/top From: =?utf-8?B?5b6M6Jek5aSn5Zyw?= In-reply-to: Date: Mon, 02 Jul 2018 17:30:24 +0900 Cc: Daichi GOTO , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-transfer-encoding: quoted-printable Message-id: References: <201807010532.w615W44e042172@repo.freebsd.org> To: Conrad Meyer X-Mailer: Apple Mail (2.3445.6.18) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2018 09:30:39 -0000 > 2018/07/02 2:08=E3=80=81Conrad Meyer =E3=81=AE=E3=83=A1= =E3=83=BC=E3=83=AB: >=20 > Hi Daichi, >=20 > On Sat, Jun 30, 2018 at 10:32 PM, Daichi GOTO = wrote: >> Author: daichi >> Date: Sun Jul 1 05:32:03 2018 >> New Revision: 335836 >> URL: https://svnweb.freebsd.org/changeset/base/335836 >>=20 >> Log: >> top(1) - support UTF-8 display >>=20 >> ... >> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >> --- head/usr.bin/top/display.c Sun Jul 1 01:56:40 2018 = (r335835) >> +++ head/usr.bin/top/display.c Sun Jul 1 05:32:03 2018 = (r335836) >> @@ -1258,19 +1258,43 @@ line_update(char *old, char *new, int start, = int line) >> char * >> printable(char str[]) >> { >> - char *ptr; >> - char ch; >> + char *ptr; >> + char ch; >>=20 >> - ptr =3D str; >> - while ((ch =3D *ptr) !=3D '\0') >> - { >> - if (!isprint(ch)) >> - { >> - *ptr =3D '?'; >> + ptr =3D str; >> + if (utf8flag) { >> + while ((ch =3D *ptr) !=3D '\0') { >> + if (0x00 =3D=3D (0x80 & ch)) { >> + if (!isprint(ch)) { >> + *ptr =3D '?'; >> + } >> + ++ptr; >> + } else if (0xC0 =3D=3D (0xE0 & ch)) { >> + ++ptr; >> + if ('\0' !=3D *ptr) ++ptr; >> + } else if (0xE0 =3D=3D (0xF0 & ch)) { >> + ++ptr; >> + if ('\0' !=3D *ptr) ++ptr; >> + if ('\0' !=3D *ptr) ++ptr; >> + } else if (0xF0 =3D=3D (0xF8 & ch)) { >> + ++ptr; >> + if ('\0' !=3D *ptr) ++ptr; >> + if ('\0' !=3D *ptr) ++ptr; >> + if ('\0' !=3D *ptr) ++ptr; >> + } else { >> + *ptr =3D '?'; >> + ++ptr; >> + } >> + } >> + } else { >> + while ((ch =3D *ptr) !=3D '\0') { >> + if (!isprint(ch)) { >> + *ptr =3D '?'; >> + } >> + ptr++; >> + } >> } >=20 >=20 > I don't think code to decode UTF-8 belongs in top(1). I don't know > what the goal of this routine is, but I doubt this is the right way to > accomplish it. >=20 > For the strvisx portion it seems like support should be rolled into > libc instead. Hi Conrad, The purpose is to display UTF-8 string. Certainly, you are right.=20 In the end I think I should support it with libc. However, I think that=20= it is a problem that UTF-8 can not be used with the top command for a = long=20 period of time. Although it may be transient, I think that keeping it to=20= work is not that bad idea. Best regards, Daichi > (Also, the patch in phabricator does not seem to match what was = committed.) >=20 > Best, > Conrad >=20