Thank you for your response. I've just tested the suggestion from the superuser.com answer. To be honest, without your explanation that answer doesn't give much clues. Simply compare it.
As I have already said, the code page defaults to
866 (or IBM CP866, the old code page since MSDOS 4.01).
BodyName = koi8-r is another code page 20866. How does it indeed work -- I don't know, cmd.exe is definitely painful.
C:\>chcp
Active code page: 866
C:\>powershell -c "[System.Text.Encoding]::Default"
IsSingleByte : True
BodyName : koi8-r
EncodingName : Cyrillic (Windows)
HeaderName : windows-1251
WebName : windows-1251
WindowsCodePage : 1251
IsBrowserDisplay : True
IsBrowserSave : True
IsMailNewsDisplay : True
IsMailNewsSave : True
EncoderFallback : System.Text.InternalEncoderBestFitFallback
DecoderFallback : System.Text.InternalDecoderBestFitFallback
IsReadOnly : True
CodePage : 1251
I tested the command from my opening post with different codes pages, setting it to
1251 or
65001 (utf-8). The only correct encoding for Cyrillic text in CLI is
1251. The default encoding in Cygwin is
en_US.UTF-8.
Updated:
I tested the script invoking it from the shell/batch script. It works correctly, if the title's encoding corresponds the encoding of the shell script. The code page 1251 only has to be specified in the batch script, independently of the encoding of the batch script itself.