如何在NCurses中打印Unicode?

5

这会打印出来

�~X�

我该如何获取Unicode编码的图标呢?
#!/usr/bin/env perl6
use v6;
use NCurses;

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

当我运行 LANG=C perl6 -e 'use NCurses; printw( "\x[263a]");' 时,我无法帮助你,因为我得到了一个核心转储。 - neuhaus
这与C有关,但在设置Locale等方面可能会有所帮助:https://dev59.com/R2445IYBdhLWcg3wydBk - mikeyq6
1个回答

4
我遇到了和你一样的问题 - 原来只需要设置地区(locale)即可。
#!/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;

那让我感到高兴...并且屏幕上也是这样。☺

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接