Subject: bug#20258: closed (Re: bug#20258: 24.5; format-time-string miscounting of multibyte characters)

From: [email-masked] (GNU bug Tracking System)
Date: Mon, 30 Sep 2019 00:36:02 +0000

Your bug report

#20258: 24.5; format-time-string miscounting of multibyte characters

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
20258: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=20258
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#20258: 24.5; format-time-string miscounting of multibyte characters
From: Stefan Kangas <[email-masked]>
To: Eli Zaretskii <[email-masked]>
Cc: [email-masked], Gunnar Horrigmo <[email-masked]>
Date: Mon, 30 Sep 2019 02:35:08 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Eli Zaretskii <[email-masked]> writes:

>> From: Gunnar Horrigmo <[email-masked]>
>> 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

I can see no bug here, only a misunderstanding about the length
function.  I'm therefore closing this bug.  If that's incorrect, please
reopen this bug report.

Best regards,
Stefan Kangas

Subject: 24.5; format-time-string miscounting of multibyte characters
From: Gunnar Horrigmo <[email-masked]>
To: [email-masked]
Date: Sat, 04 Apr 2015 16:33:50 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

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

Let me know if you need more info.

--Gunnar

In GNU Emacs 24.5.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.14.10)
 of 2015-04-01 on lumpy-gravy.uio.no
Repository revision: 1b70aa634c9ce117fed418894b54b1f2647bda1c
Windowing system distributor `StarNet Communications Corp.', version 11.0.14000
System Description:	Fedora release 21 (Twenty One)

Important settings:
  value of $LC_MONETARY: nb_NO.utf8
  value of $LC_NUMERIC: nb_NO.utf8
  value of $LC_TIME: nb_NO.utf8
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Help

Minor modes in effect:
  tooltip-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
nnimap read 417k from secure.runbox.no
nnimap read 466k from secure.runbox.no
nnimap read 581k from secure.runbox.no
nnimap read 655k from secure.runbox.no
nnimap read 729k from secure.runbox.no
Mark set
Mark saved where search started [2 times]
Making completion list...
Quit [4 times]
Type C-x 1 to delete the help window, C-M-v to scroll help.
Quit [2 times]

Load-path shadows:
/uio/kant/usit-gdw-u1/horrigmo/emacs/locate hides /uio/kant/usit-gdw-u1/horrigmo/emacs/src/emacs-24/emacs/lisp/locate

Features:
(shadow nnir emacsbug reposition sort smiley gnus-cite mm-archive
mail-extr gnus-bcklg eieio-opt speedbar sb-image ezimage dframe
find-func gnus-async qp gnus-ml disp-table pp gnus-eform debug jka-compr
misearch multi-isearch help-mode gnus-topic nndraft nnmh utf-7 gnutls
nnimap utf7 parse-time netrc network-stream starttls tls gnus-agent
gnus-srvr gnus-score score-mode nnvirtual gnus-msg gnus-art mm-uu
mml2015 nntp gnus-cache gnus-sum gnus-group gnus-undo nnfolder nnoo
nnmail mail-source avoid mm-view mml-smime smime dig mailcap gnus-start
gnus-spec gnus-int gnus-range gnus-win gnus gnus-ems wid-edit nnheader
rt-liberation edmacro kmacro browse-url markstack epa-file epa derived
epg etags info smtpmail auth-source eieio byte-opt bytecomp byte-compile
cl-extra cconv eieio-core gnus-util password-cache sendmail message
cl-macs format-spec rfc822 mml easymenu mml-sec mm-decode mm-bodies
mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mm-util help-fns
mail-prsvr mailabbrev mail-utils gmm-utils mailheader ange-ftp comint
ansi-color ring cl gv cl-loaddefs cl-lib package epg-config time-date
tooltip electric uniquify ediff-hook vc-hooks lisp-float-type mwheel
x-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list
newcomment lisp-mode prog-mode register page menu-bar rfn-eshadow timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai
tai-viet lao korean japanese hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help
simple abbrev minibuffer nadvice loaddefs button faces cus-face macroexp
files text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process
dbusbind gfilenotify dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)

Memory information:
((conses 16 278530 45717)
 (symbols 48 32240 0)
 (miscs 40 185 563)
 (strings 32 55977 9185)
 (string-bytes 1 1975855)
 (vectors 16 32030)
 (vector-slots 8 1345064 168271)
 (floats 8 255 726)
 (intervals 56 14581 139)
 (buffers 960 37)
 (heap 1024 54088 6705))

-- 
Gunnar