This command in bash works fine (Perl 5.30 shipped with Cygwin): git-md-toc -ut "some-text-in-russian" -Tutf8 "utf8-cyrillic.md" But it fails in DOS sessions -- the title is being added in wrong encoding. To resolve the issue I have to use one more option (standalone StrawberryPerl 5.30): #### #!/usr/bin/perl -- use strict; use warnings; use utf8; system $^X, q{-e}, q{ use strict; use warnings; use Encode; use Data::Dump; my @argv = map{ decode('UTF-8', $_, Encode::FB_CROAK) } @ARGV; dd\@argv; }, qq{\x{43A}\x{435}\x{431}\x{430}\x{431}}, # kebab # copy from html below cause perlmonks doesnt utf, so browser converts html entities 'кебаб', ; #### [ "\x{43A}\x{435}\x{431}\x{430}\x{431}", "\x{43A}\x{435}\x{431}\x{430}\x{431}", ]