Comment 6 for bug 393212

Revision history for this message
Simon Dierl (simon.dierl) wrote :

Binary package hint: cowsay

Ubuntu 9.04
cowsay 3.03

When piping text containing multibyte-characters to cowsay (echo "äöü" | cowsay), cowsay calculates line length based on the char* size, not the UTF-8-string size, resulting in this:

$ echo "ää" | cowsay
 ______
< ää >
 ------
        \ ^__^
         \ (oo)\_______
            (__)\ )\/\
                ||----w |
                || ||
$ echo "aa" | cowsay
 ____
< aa >
 ----
        \ ^__^
         \ (oo)\_______
            (__)\ )\/\
                ||----w |
                || ||

Note that the top bubble's size is off by 2 characters.

The length of lines must be determined using UTF-8 functions, not basic array functions to determine the screen real estate used.