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 enco +ding. To resolve the issue I have to use one more option (standalone +StrawberryPerl 5.30):

Its simple, avoid "dos sessions", use perl

#!/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 'кебаб', ;

As you can see from dd output below, кебаб is кебаб

Since perlmonks doesnt utf8 the browser converts to entities кебаб

[ "\x{43A}\x{435}\x{431}\x{430}\x{431}", "\x{43A}\x{435}\x{431}\x{430}\x{431}", ]

Why avoid dos sessions, at least unicode ones? Because its complicated. At one time I had a handle on this knowledge but long before that decided its simpler/more portable to avoid unicode in filenames and shells

How Command Line Parameters Are Parsed by David Deley

Quotes, Escape Characters, Delimiters - Windows CMD - SS64.com

Re: Non asci character and system call

Re^4: How can I get a Unicode @ARGV?

How can I get a Unicode @ARGV?

windows - How to make Unicode charset in cmd.exe by default? - Stack Overflow

Re^2: Windows 7: fork in perl script spawns new cmd window

Re: Parsing Windows CommandLine from Perl

Re: eval NoOp on cmd.exe line expr

Discipulus library

chcp can't do everything - Sorting it all Out - Site Home - MSDN Blogs

http://stackoverflow.com/questions/10764920/utf-16-on-cmd-exe

http://stackoverflow.com/questions/2182568/batch-script-is-not-executed-if-chcp-was-called

ConEmu - Handy Console Window download

Re: Perl in Windows - STDOUT to file Behavior difference by run context

Re^5: Out of date over <> and 5.10 (reproduce)

redirection problem

Win7, ASSOCiation , and @ARGV

Upside Down Text Revised

Windows console mangles UTF8 output

Re: Unicode again, in Win7 cmd (chcp 65001)

chcp can't do everything

chcp can't do everything - Sorting it all Out - Site Home - MSDN Blogs

https://illegalargumentexception.blogspot.com/2009/04/i18n-unicode-at-windows-command-prompt.html


In reply to Re: Perl, DOS and encodings by Anonymous Monk
in thread Perl, DOS and encodings by siberia-man

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.