[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#63029: [BUG?] format inconsistency in deciding string widths on diff
From: |
Ruijie Yu |
Subject: |
bug#63029: [BUG?] format inconsistency in deciding string widths on different locales |
Date: |
Sun, 23 Apr 2023 18:23:02 +0800 |
User-agent: |
mu4e 1.9.22; emacs 30.0.50 |
Hello,
I don't quite know yet whether this is a bug in Emacs. Here are the
observed results, and note the unicode character:
--8<---------------cut here---------------start------------->8---
$ for locale in {en_US,fr_FR,de_DE,zh_CN,ja_JA}.UTF-8; do
printf "$locale\t"
LANG="$locale" src/emacs -Q -batch \
-eval '(message "%S" (format "%-5.5s" "1234…"))'
done
--8<---------------cut here---------------end--------------->8---
This results in the following output:
--8<---------------cut here---------------start------------->8---
en_US.UTF-8 "1234…"
fr_FR.UTF-8 "1234…"
de_DE.UTF-8 "1234…"
zh_CN.UTF-8 "1234 "
ja_JA.UTF-8 "1234 "
--8<---------------cut here---------------end--------------->8---
Notice that in zh_CN and ja_JA, we have a space instead of the expected
ellipsis character.
If this is expected behavior, how do we know how "wide" the `format'
function thinks any given character is? In other words, why _does_ it
think "…" should be two-character wide? And how do we, the elisp users,
get this information? I tried to dive into the C code for
`styled_format', but got lost. Thanks.
----------
Reproduced on this in-source build:
In GNU Emacs 30.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version
3.24.37, cairo version 1.17.8) of 2023-04-23 built on fw.net.yu
Repository revision: 3badd2358d5f0af71887ee1cc9d39c2f312b6888
Repository branch: master
System Description: Arch Linux
Configured using:
'configure --sysconfdir=/etc --prefix=/usr --localstatedir=/var
--with-cairo --with-harfbuzz --with-libsystemd --with-modules
--with-pgtk --with-native-compilation CFLAGS=-Og'
Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY
PDUMPER PGTK PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM GTK3 ZLIB
--
Best,
RY
[Please note that this mail might go to spam due to some
misconfiguration in my mail server -- still investigating.]
- bug#63029: [BUG?] format inconsistency in deciding string widths on different locales,
Ruijie Yu <=