How to print "mailboxes for boxes" Unicode characters in C (Linux terminal utf8)?

I am trying to display Unicode characters from (Box Drawing Range: 2500-257F). It must be standard utf8 (Unicode standard, version 6.2). I just can't do it.

At first I tried to use the good old ASCII characters, but the Linux terminal displayed in utf8 and there is no conversion (character?) Displayed in place.

Can anyone answer these questions:

  • How to encode a Unicode character in a C ( style wchar_t) variable ?
  • How to use escape sequence like 0x or 0o (hex, oct) for Unicode?

I know U +, but it doesn't seem to work.

setlocale(LC_ALL,"");
short a = 0x2500, b = 0x2501;
wchar_t ac = a;
wchar_t bc = b;
wprintf(L"%c%c\n", ac, bc);
exit(0);

, , utf8 (http://www.unicode.org/charts/fonts.html) 2500 257F... .

...

+3
2

Cstring, utf-8. Cstring, .

:

#include <stdio.h>

int main (int argc, char *argv[])
{
    char block1[] = { 0xe2, 0x94, 0x80, '\0' };
    char block2[] = { 0xe2, 0x94, 0x81, '\0' };
    printf("%s%s\n", block1, block2);
    return 0;
}

โ”€โ” .

, Cstring, - uft-8, - , . /* , gcc */ IIRC gcc utf-8 .

: , . . - ? , , , , .

+4

, "".

linux unicode, 512 IIRC, Unicode, , , ( ).

Windows, Linux, , .

, , ascii-land

Linux GUI- ( gnome-terminal) , .

, ncurses ?

0

All Articles