From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#20258: 24.5; format-time-string miscounting of multibyte characters Date: Sat, 04 Apr 2015 18:42:13 +0300 Message-ID: <83r3rzoq7e.fsf@gnu.org> References: Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT X-Trace: ger.gmane.org 1428162200 4375 80.91.229.3 (4 Apr 2015 15:43:20 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 4 Apr 2015 15:43:20 +0000 (UTC) Cc: 20258@debbugs.gnu.org To: Gunnar Horrigmo Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Apr 04 17:43:11 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YeQE1-0003XO-Hm for geb-bug-gnu-emacs@m.gmane.org; Sat, 04 Apr 2015 17:43:09 +0200 Original-Received: from localhost ([::1]:33473 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YeQE0-00016x-Uz for geb-bug-gnu-emacs@m.gmane.org; Sat, 04 Apr 2015 11:43:08 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39469) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YeQDx-00016s-T3 for bug-gnu-emacs@gnu.org; Sat, 04 Apr 2015 11:43:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YeQDu-0002x5-Mf for bug-gnu-emacs@gnu.org; Sat, 04 Apr 2015 11:43:05 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:55076) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YeQDu-0002x1-J3 for bug-gnu-emacs@gnu.org; Sat, 04 Apr 2015 11:43:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YeQDt-0007PA-UE for bug-gnu-emacs@gnu.org; Sat, 04 Apr 2015 11:43:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 04 Apr 2015 15:43:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20258 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 20258-submit@debbugs.gnu.org id=B20258.142816214128415 (code B ref 20258); Sat, 04 Apr 2015 15:43:01 +0000 Original-Received: (at 20258) by debbugs.gnu.org; 4 Apr 2015 15:42:21 +0000 Original-Received: from localhost ([127.0.0.1]:44852 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YeQDF-0007OE-9a for submit@debbugs.gnu.org; Sat, 04 Apr 2015 11:42:21 -0400 Original-Received: from mtaout22.012.net.il ([80.179.55.172]:34460) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YeQDD-0007O0-FX for 20258@debbugs.gnu.org; Sat, 04 Apr 2015 11:42:20 -0400 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0NMA00700GHMQK00@a-mtaout22.012.net.il> for 20258@debbugs.gnu.org; Sat, 04 Apr 2015 18:42:13 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NMA007GXGYCIOA0@a-mtaout22.012.net.il>; Sat, 04 Apr 2015 18:42:13 +0300 (IDT) In-reply-to: X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:101190 Archived-At: > From: Gunnar Horrigmo > Date: Sat, 04 Apr 2015 16:33:50 +0200 > > > As the subject says, format-time-string miscounts multibyte characters. > Simple example with nb_NO.utf8 locale, where ø is two bytes: > > (format-time-string "%6a" (date-to-time "Sat Apr 4 16:14:40 2015")) > " lø." > > (length (format-time-string "%6a" (date-to-time "Sat Apr 4 16:14:40 2015"))) > 5 'length' counts characters, not bytes. If you need to count bytes, use 'string-bytes' instead: (string-bytes " lø.") => 6