Cygwin 3.1 forcibly set wrong console code page

Andrey Repin anrdaemon@yandex.ru
Sat Dec 28 00:39:00 GMT 2019


Greetings, All!

Despite having "chcp.com 65001" in .bashrc, current codepage now reset to
CP1251 (which is rather surprising, considering that default console codepage
for russian cyrillic is 866).

I don't have the full understanding of what's happening, but somehow
PROMPT_COMMAND is involved.

The observed effect is this:
I have
1.
PROMPT_COMMAND='printf "\e]0;${debian_chroot:+($debian_chroot)}${USER:-$USERNAME}@${HOSTNAME}: ${PWD/$HOME/\~}\a"'
2.
chcp.com 65001

in the .bashrc, in that order.
When I start mintty (as login shell or as regular interactive shell), chcp
reports CP1251.
If I run something like

$ uname -a; chcp; chcp 65001; chcp

It will report that CP was changed successfully

$ uname -a; chcp; chcp 65001; chcp
CYGWIN_NT-6.1 daemon2 3.1.2(0.340/5/3) 2019-12-21 15:25 x86_64 Cygwin
’ҐЄгй п Є®¤®ў п бва ­Ёж : 1251
Active code page: 65001
Active code page: 65001

but an immediate call to chcp afterwards reports

$ chcp
’ҐЄгй п Є®¤®ў п бва ­Ёж : 1251

Ooopsss??

Now, the puzzling part:

(New mintty login shell)
Active code page: 65001
anrdaemon@daemon2:xterm:~
$ echo "$PROMPT_COMMAND"
__bash_prompt
anrdaemon@daemon2:xterm:~
$ chcp
’ҐЄгй п Є®¤®ў п бва ­Ёж : 1251
anrdaemon@daemon2:xterm:~
$ unset PROMPT_COMMAND
anrdaemon@daemon2:xterm:~
$ chcp 65001
Active code page: 65001
anrdaemon@daemon2:xterm:~
$ chcp
Active code page: 65001
anrdaemon@daemon2:xterm:~
$ PROMPT_COMMAND=__bash_prompt
anrdaemon@daemon2:xterm:~
$ chcp
Active code page: 65001
anrdaemon@daemon2:xterm:~
$ chcp
Active code page: 65001
anrdaemon@daemon2:xterm:~
$ netsh int ip show dns

Настройка интерфейса "Подключение по локальной сети"
...

All working line nothing happened.
Why???


-- 
With best regards,
Andrey Repin
Friday, December 27, 2019 18:56:50

Sorry for my terrible english... РўТРРҐ&ц&ЖVТ&Wч'G3ў‡GGўтц7–wv–вж6цТч&ц&ЖVЧ2ж‡FЦАР¤dў‡GGўтц7–wv–вж6цТцfрР¤Fц7VЦVзFF–цгў‡GGўтц7–wv–вж6цТцFц72ж‡FЦАРҐVз7V'67&–&R–жfуў‡GGўтц7–wv–вж6цТцЦВт7Vз7V'67&–&RЧ6–ЧЖPР Р


More information about the Cygwin mailing list