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: Eli Zaretskii <eliz <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 20258 <at> debbugs.gnu.org, 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 10:01:17 +0300
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Date: Mon, 30 Sep 2019 05:09:08 +0200
> Cc: stefan <at> marxist.se, gunnar.horrigmo <at> usit.uio.no
> 
> 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.
> ---
> 
> But the natural interpretation of "positions" isn't bytes, I think, and
> if is, then the doc string should say so.
> 
> (let ((system-time-locale "nb_NO.UTF-8"))
>   (format-time-string "%6a" (date-to-time "Sat Apr  4 16:14:40 2015")))
> => "  lø."
> 
> (if you have that locale in /etc/locale.gen.)
> 
> But I seem to remember from previous discussions that this quirk is in
> the C strftime function?  And Emacs just call it?

Yes, that's true.

> So I think what WIDTH means should be said explicitly in the doc string.

It can only warn that WIDTH _might_ be measured in bytes, since the
underlying implementation of strftime just might DTRT.  Or not.

I think this should be raised as a bug to glibc developers, as their
documentation says "characters", according to my reading.




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

Previous Next


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