From owner-freebsd-arch@FreeBSD.ORG Sun Jan 25 22:58:25 2015 Return-Path: Delivered-To: arch@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 487E7B6E; Sun, 25 Jan 2015 22:58:25 +0000 (UTC) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.freebsd.org (Postfix) with ESMTP id 0663A289; Sun, 25 Jan 2015 22:58:24 +0000 (UTC) Received: from critter.freebsd.dk (unknown [192.168.60.3]) by phk.freebsd.dk (Postfix) with ESMTP id 0432F3B8B7; Sun, 25 Jan 2015 22:58:21 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.14.9/8.14.9) with ESMTP id t0PMwKWe024714; Sun, 25 Jan 2015 22:58:20 GMT (envelope-from phk@phk.freebsd.dk) To: Baptiste Daroussin Subject: Re: [RFC] Set the default locale to en_US.UTF-8 In-reply-to: <20150125184608.GO81001@ivaldir.etoilebsd.net> From: "Poul-Henning Kamp" References: <20150124143357.GI81001@ivaldir.etoilebsd.net> <20150125143243.GB76051@zxy.spb.ru> <7B1D8345-248B-4C44-9568-079BA29614C2@ixsystems.com> <23506.1422204612@critter.freebsd.dk> <20150125184608.GO81001@ivaldir.etoilebsd.net> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <24712.1422226700.1@critter.freebsd.dk> Content-Transfer-Encoding: quoted-printable Date: Sun, 25 Jan 2015 22:58:20 +0000 Message-ID: <24713.1422226700@critter.freebsd.dk> Cc: arch@FreeBSD.org, Jordan Hubbard , Slawa Olhovchenkov X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Jan 2015 22:58:25 -0000 -------- In message <20150125184608.GO81001@ivaldir.etoilebsd.net>, Baptiste Darous= sin w rites: >> The point about vi(1) is that if you happen to open an ISO-8859 file >> while in UTF-8 mode, change something on the first line, it will >> happily and almost imperceptively truncate your file at the first >> non-UTF byte sequence. >> = >> Needless to say, that is *not* the expected behaviour. > >That was the case with old vi not with the vi we have in head at least I'= m = >not able to truncate files with actual vi critter phk> env | grep -i utf XTERM_LOCALE=3Den_US.UTF-8 LC_CTYPE=3Den_US.UTF-8 critter phk> uname -a FreeBSD critter.freebsd.dk 11.0-CURRENT FreeBSD 11.0-CURRENT #12 r275575: = Sun Dec 7 11:08:11 UTC 2014 root@critter.freebsd.dk:/freebsd/obj/free= bsd/svn_src/head/sys/GENERIC amd64 critter phk> ascii > /tmp/_ critter phk> ls -l /tmp/_ -rw-rw-r-- 1 phk wheel 882 Jan 25 22:54 /tmp/_ critter phk> vi /tmp/_ (Shows first two lines) :w! :q critter phk> ls -l /tmp/_ -rw-rw-r-- 1 phk wheel 98 Jan 25 22:56 /tmp/_ The sourcecode for the ascii programs is: #include int main(int argc __unused, char **argv __unused) { int x, y, z; for (x =3D 0 ; x < 16; x++) printf("%02x ", x * 16); printf("\n"); for (x =3D 0 ; x < 16; x++) printf("---"); printf("\n"); for (y =3D 0; y < 16; y++) { for (x =3D 0 ; x < 16; x++) { z =3D y + x * 16; if ((x & 7) >=3D 2 && z !=3D 0x7f) printf("%c ", z); else printf("%02x ", z); } putchar('\n'); } } -- = Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe = Never attribute to malice what can adequately be explained by incompetence= .