2016-02-24 16 views
5

これは私が代わりにユニコードを得ることができる方法NCursesでUnicodeを印刷するには?

�~X� 

を出力しますか?

#!/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

「LANG = C perl6 -e」を実行すると、NCursesを使用することはできません。 printw( "\ x [263a]"); "私はコアダンプを取得します。 – neuhaus

+0

これはCに関連していますが、ロケールなどを設定する上で参考になります。http://stackoverflow.com/questions/4703168/adding-unicode-utf8-chars-to-a-ncurses-display-in- c – mikeyq6

答えて

3

私はあなたと同じようになっていました。ロケールを設定するだけでした。

#!/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; 

これは私の顔に笑みを浮かべています...そして画面。 ☺

関連する問題