From owner-freebsd-current@freebsd.org Wed Nov 25 00:15:18 2015 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 91B44A36674 for ; Wed, 25 Nov 2015 00:15:18 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: from mail-wm0-x229.google.com (mail-wm0-x229.google.com [IPv6:2a00:1450:400c:c09::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 24A5F1038; Wed, 25 Nov 2015 00:15:18 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: by wmww144 with SMTP id w144so160022990wmw.1; Tue, 24 Nov 2015 16:15:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=aRDEw/VXUxSdk+6XvD5dyJ6RoqJ1K7Vr8DzhHMi/0tc=; b=IA1nbRszIZ7dgnCd1ueflQE4ooiEP/yI0oteBAmRXS04rbIqF799Ut0rQVYb0ZJf3Z TkhO3CDH6po/MswhviJ5pxau+ypO25nKsoF/yY2rkHMt60m8J0ghN0sLutCf72IAe6F+ pUr3eNjifC7TPhMzRTGQt/YjaQjbuOaGILMsr1XsKRMO2CT0RHKY1Y546E2yT6u8tkJZ Ha+z0D5ZzheRLThcA6GjTzmD88i/y36ONxo3kud1eIysAsqxS1JlM6CmdT0CJSgOCKBn SkQDtSMhKbuYdMLSbeIuP52ykmmzGstPBY+6VdgdyBGJlVXyy0VC9vQLQz3Msgo8nLPv TAHA== X-Received: by 10.194.185.6 with SMTP id ey6mr40154124wjc.42.1448410516601; Tue, 24 Nov 2015 16:15:16 -0800 (PST) Received: from ivaldir.etoilebsd.net ([2001:41d0:8:db4c::1]) by smtp.gmail.com with ESMTPSA id 200sm893557wmn.11.2015.11.24.16.15.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Nov 2015 16:15:15 -0800 (PST) Sender: Baptiste Daroussin Date: Wed, 25 Nov 2015 01:15:13 +0100 From: Baptiste Daroussin To: Andrey Chernov Cc: Ed Schouten , Jilles Tjoelker , "Sergey V. Dyatko" , FreeBSD Current Subject: Re: /bin/ls formatting broken for non-C(?) locales Message-ID: <20151125001513.GC70014@ivaldir.etoilebsd.net> References: <20151120110556.6e20a71f@laptop.minsk.domain> <20151120104253.GA21071@ivaldir.etoilebsd.net> <20151120110212.GB21071@ivaldir.etoilebsd.net> <20151120122352.GA5751@stack.nl> <20151121003541.GF21071@ivaldir.etoilebsd.net> <5650DACA.2090501@freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="1ccMZA6j1vT5UqiK" Content-Disposition: inline In-Reply-To: <5650DACA.2090501@freebsd.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Nov 2015 00:15:18 -0000 --1ccMZA6j1vT5UqiK Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Nov 21, 2015 at 11:57:46PM +0300, Andrey Chernov wrote: > On 21.11.2015 15:18, Ed Schouten wrote: > > Hi Baptiste, > >=20 > > I suppose you should use the wcswidth() function somewhere to compute > > the visible width of the month name. Some characters may be > > double-width, others may have no effective width at all. > >=20 >=20 > I agree. Checking error return of wide chars functions with some > fallback will be good too. I have updated the code https://reviews.freebsd.org/D4239 Tested by modifying some locales to add double width and zero width unicode= in the locales Also added the error checking for the return of wide chars functions. For n= ow I haven't added fallback, suggestions welcome if needed. Best regards, Bapt --1ccMZA6j1vT5UqiK Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlZU/ZEACgkQ8kTtMUmk6ExUtACgs8xFg+1g0rt8/e+NF30AV2Yf 8bcAn3RHXyepWHrG71dmNkjVaxWi+s8J =Xci3 -----END PGP SIGNATURE----- --1ccMZA6j1vT5UqiK--