GNU bug report logs - #20258
24.5; format-time-string miscounting of multibyte characters

Previous Next

Package: emacs;

Reported by: Gunnar Horrigmo <gunnar.horrigmo <at> usit.uio.no>

Date: Sat, 4 Apr 2015 15:36:01 UTC

Severity: minor

Tags: fixed, patch

Found in version 24.5

Fixed in version 27.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 20258 <at> debbugs.gnu.org, Andreas Schwab <schwab <at> suse.de>, stefan <at> marxist.se, gunnar.horrigmo <at> usit.uio.no
Subject: bug#20258: 24.5; format-time-string miscounting of multibyte characters
Date: Mon, 30 Sep 2019 15:39:15 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

>> The POSIX descriptions says bytes.
>
> Right.  So it might be a glibc documentation bug (or maybe the glibc
> manual I have here is outdated).
>
> And there is the issue with non-glibc implementations.

What about something appropriately vague like the following patch to
draw attention to the issue:

diff --git a/src/timefns.c b/src/timefns.c
index 330d5623f0..20f7ccb7d7 100644
--- a/src/timefns.c
+++ b/src/timefns.c
@@ -1437,8 +1437,11 @@ DEFUN ("format-time-string", Fformat_time_string, Sformat_time_string, 1, 3, 0,
 `^' Use upper case characters if possible.
 `#' Use opposite case characters if possible.
 
-A field width N is an unsigned decimal integer with a leading digit nonzero.
-%NX is like %X, but takes up at least N positions.
+A field width N is an unsigned decimal integer with a leading digit
+nonzero.  %NX is like %X, but takes up at least N positions.  The
+field width is (on most systems) in bytes, not characters, so it
+depends on the locale what the width (in characters) %NX will end up
+being.
 
 The modifiers are:
 


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




This bug report was last modified 5 years and 235 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.