How to overcome error while inserting Russian text into Redis using Perl script?

When you try to insert a record containing Russian language I get this error:
command sent is not an octet sequence in the native encoding (Latin-1). Consider using debug mode to see the command itself.
Error occurs on line:
my $status = $redis->hset("postavshik", 1, $text);

Encoding the variable $text is UTF-8.
utf8::is_utf8( $text ) returns 1.

In the beginning of the script directives:
use utf8;
no warnings "utf8";
use open qw(:std :utf8);

A connection to Redis:
my $redis = Redis->new(
server => 'localhost:6379',
encoding => undef,
I tried encoding => 'utf8', too.
June 7th 19 at 14:46
1 answer
June 7th 19 at 14:48
You can try

use Encode;
my $status = $redis->hset("postavshik", 1, $text);

Find more questions by tags Character encodingRedisPerl