emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

format width specifier and locale


From: Joost Kremers
Subject: format width specifier and locale
Date: Wed, 23 Feb 2022 21:02:31 +0100
User-agent: mu4e 1.6.9; emacs 28.0.91

Hi list,

While looking into a bug report for a package of mine,[1] it turned out that 
part
of the bug is caused by a strange interaction between `format` and the system's
locale that looks like a bug, but I'd like to ask here first before I submit a
bug report.

The following two `format` calls produce identical-length strings when issued in
an Emacs with `current-language-environment` set to "English" (or, in my case
"UTF-8"), but when the language environment is set to "Chinese-GBK", the second
call produces a string that is one character shorter:

    (format (concat "%50s") "Boutet de Monvel's calculus and groupoids I")
    (format (concat "%50s") "Boutet de Monvel’s calculus and groupoids I") 

The difference between the two string is the apostrophe character: in the first
string, it's an ASCII apostrophe, in the second string it's a RIGHT SINGLE
QUOTATION MARK.

The effect can be seen in this screen shot:

Attachment: Screenshot from 2022-02-23 21.19.14.png
Description: PNG image

The font used is DejaVu Sans Mono. I switched language environment with `M-x
set-language-environment`. The second string produced in the Chinese language
environment has one space less.

So is there a reason this is happening, or is it indeed a bug?

TIA

Joost




Footnotes:
[1]  <https://github.com/joostkremers/ebib/issues/243>.

-- 
Joost Kremers
Life has its moments

reply via email to

[Prev in Thread] Current Thread [Next in Thread]