Home > front end >  Printing Cyrillic text in Curses::UI
Printing Cyrillic text in Curses::UI

Time:02-22

I am trying to print Cyrillic text in Curses::UI (this is the demo code with the label and the TextEditor of the code in russian):

#!/usr/bin/perl -w

use strict;
use Curses::UI;

use utf8;

my $cui = new Curses::UI( -color_support => 1 );
my @menu = (
    { -label => 'Файл',
        -submenu => [
            { -label => 'Exit      ^Q', -value => \&exit_dialog  }
        ]
    },
);
sub exit_dialog()
{
    my $return = $cui->dialog(
        -message   => "Do you really want to quit?",
        -title     => "Are you sure???",
        -buttons   => ['yes', 'no'],
    );

    exit(0) if $return;
}
my $menu = $cui->add(
    'menu','Menubar',
    -menu => \@menu,
    -fg  => "blue",
);
my $win1 = $cui->add(
    'win1', 'Window',
    -border => 1,
    -y    => 1,
    -bfg  => 'red',
);
my $texteditor = $win1->add("text", "TextEditor",
    -text => "привет!\n"
    . "Some Russian word.");
$cui->set_binding(sub {$menu->focus()}, "\cX");
$cui->set_binding( \&exit_dialog , "\cQ");
$texteditor->focus();
$cui->mainloop();

When I run the script, the Cyrillic is outputted in gibberish. Is there any way to fix this? I tried looking at the Language module but was not able to find anything helpful. I only saw that they use KOI8-R encoding, could this be something that I must take into account?

enter image description here

Other information: On MacOs, using perl version 5.34.0.

Thanks for the help!

CodePudding user response:

Curses::UI dates from 2002/2003 (see enter image description here

  • Related