[Konsole-devel] Printing a Unicode Character on Konsole

Christian Heller christian.heller at tuxtax.de
Sat Feb 4 11:01:16 UTC 2006


Dear Konsole Developers,

I have a question concerning the printing of a Unicode character > 256
on "Konsole". Since two days I am trying without success.
As example, let us take the following character:

    // BOX_DRAWINGS_LIGHT_ARC_UP_AND_RIGHT_CHARACTER
    int c = 9584;
    // One could also define it as: wchar_t c = 9584;

How to print it on Konsole? Is "Konsole" really UTF-8 ready?
I've tried:

    putwchar(c);

and also:

    if (c < 0x80) {

        putchar(c);

    } else if (c < 0x800) {

        putchar(0xC0 | c >> 6);
        putchar(0x80 | c & 0x3F);

    } else if (c < 0x10000) {

        putchar(0xE0 | c >> 12);
        putchar(0x80 | c >> 6 & 0x3F);
        putchar(0x80 | c & 0x3F);

    } else if (c < 0x200000) {

        putchar(0xF0 | c >> 18);
        putchar(0x80 | c >> 12 & 0x3F);
        putchar(0x80 | c >> 6 & 0x3F);
        putchar(0x80 | c & 0x3F);
    }

Where is my mistake? Could someone give a short example?
Any help appreciated!

Thanks,
Christian



More information about the konsole-devel mailing list