2016-02-24 11 views
5

DrukujeJak wydrukować Unicode za pomocą programu NCurses?

�~X� 

Jak mogę uzyskać Unicode zamiast?

#!/usr/bin/env perl6 
use v6; 
use NCurses; 

my $win = initscr; 
my Str $s = "\x[263a]"; 
printw($s); 
nc_refresh; 
while getch() < 0 {}; 
endwin; 
+0

Nie mogę ci pomóc, gdy uruchomię 'LANG = C perl6 -e 'użyj NCurses; printw ("\ x [263a]"); "Dostaję coredump. – neuhaus

+0

Jest to powiązane z C, ale może być pomocne pod względem ustawień regionalnych i innych: http://stackoverflow.com/questions/4703168/adding-unicode-utf8-chars-to-a-ncurses-display-in- do – mikeyq6

Odpowiedz

3

Otrzymałem to samo co ty - okazało się potrzebne tylko do ustawienia lokalizacji;

#!/usr/bin/env perl6 
use v6; 
use NCurses; 

use NativeCall; 
my int32 constant LC_ALL = 6;   # From locale.h 
my sub setlocale(int32, Str) returns Str is native(Str) { * } 

setlocale(LC_ALL, ""); 
my $win = initscr; 
my Str $s = "\x[263a]"; 
printw($s); 
nc_refresh; 
while getch() < 0 {}; 
endwin; 

To wywołuje uśmiech na mojej twarzy ... i ekranie. ☺

Powiązane problemy