<<< Date Index >>>     <<< Thread Index >>>

Re: mutt_FormatString() not multibyte-aware



On Tue, 2006-07-04 12:20:49 +0000, Rocco Rutte wrote:
> [..] with which you can easily determine how much bytes a multibyte 
> character from a 'char*' has and that is what we need for padding.

This is _not_ what we need for padding.

For UTF-8 strings, there are 3 numbers:

 1) the number of bytes,
 2) the number of characters, and
 3) the number of character cells on the screen.

Note, the latter two aren't the same. Even with a fixed-width
character set, many characters are wider than others and thus occupy
two character cells.

For padding, we need to count the number of character cells, not the
number of characters, and thus, we need something like wcwidth().

(I wonder why Tamo didn't jump into that earlier -- Maybe he's just
tired of explaining to the Europeans there are other scripts than
Latin.)

Ludolf