From owner-freebsd-questions@FreeBSD.ORG Tue Jan 27 16:44:17 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3B8561065670 for ; Tue, 27 Jan 2009 16:44:17 +0000 (UTC) (envelope-from fbsd.questions@rachie.is-a-geek.net) Received: from mail.rachie.is-a-geek.net (rachie.is-a-geek.net [66.230.99.27]) by mx1.freebsd.org (Postfix) with ESMTP id 0EB4D8FC1A for ; Tue, 27 Jan 2009 16:44:16 +0000 (UTC) (envelope-from fbsd.questions@rachie.is-a-geek.net) Received: from localhost (mail.rachie.is-a-geek.net [192.168.2.101]) by mail.rachie.is-a-geek.net (Postfix) with ESMTP id 54686AFC1FE; Tue, 27 Jan 2009 07:44:16 -0900 (AKST) From: Mel To: freebsd-questions@freebsd.org Date: Tue, 27 Jan 2009 07:44:15 -0900 User-Agent: KMail/1.9.10 References: <497E31EE.9010202@lvor.halvorsen.cc> In-Reply-To: <497E31EE.9010202@lvor.halvorsen.cc> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200901270744.16043.fbsd.questions@rachie.is-a-geek.net> Cc: Svein Halvor Halvorsen Subject: Re: printf and utf-8 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jan 2009 16:44:17 -0000 On Monday 26 January 2009 12:58:06 Svein Halvor Halvorsen wrote: > As far as I can see, printf is not calculating strings lengths correctly > when using utf-8 encoding. Either that, or I'm using byte count, and > can't find the character count :-/ > > Eg: > > $ printf "|%-10s|" "=E6=F8=E5" > > |=E6=F8=E5 | > > $ printf "|%-10s|" "123" > > |123 | > > I'm on 7.1-p2 Does this work on an xterm (or anything else then the FreeBSD console) with= =20 correct LANG variable set? The FreeBSD console does not work with utf-8 (yet), allthough I would not=20 think it should affect printf's character counting, still.....it haunts me. =2D-=20 Mel Problem with today's modular software: they start with the modules and never get to the software part.