bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

utf-8 & ncurses


From: folkert
Subject: utf-8 & ncurses
Date: Tue, 17 Aug 2010 10:30:32 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

Hi,

I'm trying to get ncurses and utf-8 to work with each other.
Let's say I have a string 'string' and an index 'loop'. Now in this
string some utf-8 characters may exist. I try to filter these out and
print them.

#include <ncursesw/ncurses.h>

        if ((string[loop] & 0xe0) == 0xc0)
        {
                wadd_wch(win -> win, (string[loop] << 8) + string[loop + 1]);
                loop += 1;
        }
        else if ((string[loop] & 0xf0) == 0xe0)
        {
                wadd_wch(win -> win, (string[loop] << 16) + (string[loop + 1] 
<< 8) + string[loop + 2]);
                loop += 2;
        }
...

This doesn't work. No special characters are shown.

I also tried:
        if ((string[loop] & 0xe0) == 0xc0)
        {
                wadd_wch(win -> win, (&string[loop]));
                loop += 1;
        }
        else if ((string[loop] & 0xf0) == 0xe0)
        {
                wadd_wch(win -> win, (&string[loop]));
                loop += 2;
        }

Worked neither.
Anyone got a suggestion how to proceed?


Thanks,

Folkert van Heusden

-- 
Looking for a cheap but fast webhoster with an excellent helpdesk?
http://keetweej.vanheusden.com/redir.php?id=1001
----------------------------------------------------------------------
Phone: +31-6-41278122, PGP-key: 1F28D8AE, www.vanheusden.com



reply via email to

[Prev in Thread] Current Thread [Next in Thread]