How to print Unicode with NCurses?

Will print

 ~X  

How can I get unicode instead?

 #!/usr/bin/env perl6 use v6; use NCurses; my $win = initscr; my Str $s = "\x[263a]"; printw( $s ); nc_refresh; while getch() < 0 {}; endwin; 
+5
source share
1 answer

I got the same thing as you - you just need to set the 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; 

It puts a smile on my face ... and the screen. ☺

+3
source

Source: https://habr.com/ru/post/1243748/


All Articles