[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bino-list] Bug: translation of Usage text using UTF-8
From: |
Martin Lambers |
Subject: |
Re: [Bino-list] Bug: translation of Usage text using UTF-8 |
Date: |
Mon, 18 Apr 2011 20:45:37 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.14) Gecko/20110223 Thunderbird/3.1.8 |
Hi Alexey!
On 17/04/11 20:21, Alexey Osipov wrote:
> In process of making russian translation for bino, I've found a bug,
> which makes translated Usage text seem not quite good.
>
> In msg::msg_txt you use 'for' loop to cycle through std::string,
> representing a text (the Usage text in particular), and count symbols to
> determine the line length. But if text is in UTF-8 (or other multi-byte
> encoding), the counting is doing wrong - two-byte character counts for
> two characters. So the total allowed length of the string becomes less
> than default 80 columns and hence translated string is wrapped to the
> next line.
>
> See attached screenshot.
>
> You should use std::wstring or something to count multi-byte characters
> as one character.
You are right. This should fix it:
http://git.savannah.gnu.org/cgit/bino.git/commit/?id=66993854b13c0039d98ce3e7b3e2ec8856236c98
On systems that have wcwidth(), this should also work with locales where
one character does not necessarily mean one output column.
Does this work for you?
Martin