* Carsten Hey <c....@web.de> [2009-02-11 23:36]:

> Correctly displaying columns when using double wide characters (e.g. タ) will
> not work when g_utf8_strlen(str, -1) or mbstowcs(NULL, str, 0) is used since
> they return the number of characters instead of the number of columns needed 
> to
> display a string.  Maybe you find a sane way to fix get the number of columns
> needed, e.g. by combining mbstowcs() and wcswidth().  I don't consider the 
> wide
> character support to be a part of this bug report.

It happens that the problem with the column display has nothing to do with
ncurses, but with sprintf.  Each line in the index screen is produced with a
code in src/entry.c that is roughly like this:

   sprintf (menu_name, "%-12.12s %-12.12s %-30.30s %-18.18s",
            family_name ? family_name : "",
            given_name ? given_name : "", email ? email : "", tel ? tel : "");

I could not find a simple way to make sprintf do the right thing with
strings containing UTF-8 characters..  For instance, the code below:

#include <stdio.h>
main () {
  printf ("|%-5s   |\n", "é");
  printf ("|%-5s   |\n", "e");
}

yields in my UTF-8 enabled system:

|é      |
|e       |

At any rate, thanks to your suggestion about g_utf8_strlen, I hacked a
solution in the rolo package that seems to work and will appear in the
forthcoming version of the package in unstable, rolo_011.dfsg.1-12.  Please,
test.

It is too bad that the development of rolo has ceased upstream.  It seems
that I am the upstream maintainer now, against my will :-(

Cheers,

-- 
Rafael



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to