From owner-freebsd-questions@FreeBSD.ORG Mon Jan 26 21:52:04 2009 Return-Path: Delivered-To: questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 13350106564A for ; Mon, 26 Jan 2009 21:52:04 +0000 (UTC) (envelope-from svein.h@lvor.halvorsen.cc) Received: from bene2.itea.ntnu.no (bene2.itea.ntnu.no [IPv6:2001:700:300:3::57]) by mx1.freebsd.org (Postfix) with ESMTP id 8B59E8FC08 for ; Mon, 26 Jan 2009 21:52:03 +0000 (UTC) (envelope-from svein.h@lvor.halvorsen.cc) Received: from localhost (localhost [127.0.0.1]) by bene2.itea.ntnu.no (Postfix) with ESMTP id B958F90005 for ; Mon, 26 Jan 2009 22:52:01 +0100 (CET) Received: from maren.thelosingend.net (maren.math.ntnu.no [129.241.211.48]) by bene2.itea.ntnu.no (Postfix) with SMTP id 6289590004 for ; Mon, 26 Jan 2009 22:52:01 +0100 (CET) Received: (qmail 4123 invoked by uid 88); 26 Jan 2009 22:49:20 +0100 Received: from maren.math.ntnu.no (HELO [127.0.0.1]) (129.241.211.48) by maren.thelosingend.net (qpsmtpd/0.31.1) with ESMTP; Mon, 26 Jan 2009 22:49:20 +0100 Message-ID: <497E31EE.9010202@lvor.halvorsen.cc> Date: Mon, 26 Jan 2009 22:58:06 +0100 From: Svein Halvor Halvorsen User-Agent: Thunderbird 2.0.0.18 (X11/20081205) MIME-Version: 1.0 To: questions@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: Debian amavisd-new at bene2.itea.ntnu.no Cc: Subject: 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: Mon, 26 Jan 2009 21:52:04 -0000 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|" "זרו" |זרו | $ printf "|%-10s|" "123" |123 | I'm on 7.1-p2 sv.