Skip to content

Fix progress bar width for multibyte charsets

When using locale in which symbols occupy more than 1 byte (for example, ru_RU.UTF-8), the progress bar width was calculated incorrectly because std::string::size() returns the number of bytes rather than the number of actual characters. As the result, the progress bar was displayed too short in such locales.

The MR consists of 2 commits. The first one introduces a new function APT::String::DisplayLength() which returns string length honoring multibyte characters. The second commit makes use of this newly introduced function to calculate progress bar width.

Before

Before-C

Before-ru_RU

Before-zh_CN

After

After-C

After-ru_RU

After-zh_CN

Edited by Алексей Шилин

Merge request reports

Loading