]> git.ipfire.org Git - thirdparty/xz.git/commit
tuklib_mbstr_width: Change the behavior when wcwidth() is not available
authorLasse Collin <lasse.collin@tukaani.org>
Mon, 16 Dec 2024 18:06:07 +0000 (20:06 +0200)
committerLasse Collin <lasse.collin@tukaani.org>
Wed, 18 Dec 2024 17:22:01 +0000 (19:22 +0200)
commit4e0ebbabe45b8a988a5e8aa524e2a69220b8320b
tree16866a705d03ee707b951b712adc807848f8aecc
parent4ff609adb00ab3264b91cc9c2f7c44a360348795
tuklib_mbstr_width: Change the behavior when wcwidth() is not available

If wcwidth() isn't available (Windows), previously it was assumed
that one byte == one column in the terminal. Now it is assumed that
one multibyte character == one column. This works better with UTF-8.
Languages that only use single-width characters without any combining
characters should work correctly with this.

In xz, none of po/*.po contain combining characters and only ko.po,
zh_CN.po, and zh_TW.po contain fullwidth characters. Thus, "only"
those three translations in xz are broken on Windows with the
UTF-8 code page. Broken means that column headings in xz -lvv and
(only in the master branch) strings in --long-help are misaligned,
so it's not a huge problem. I don't know if those three languages
displayed perfectly before the UTF-8 change because I hadn't tested
translations with native Windows builds before.

Fixes: 46ee0061629fb075d61d83839e14dd193337af59
(cherry picked from commit b797c44c42ea54fe1c52722a2fca0c9618575598)
src/common/tuklib_mbstr_width.c