public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Cygwin 3.1 forcibly set wrong console code page
@ 2019-12-28  0:39 Andrey Repin
  2019-12-28 12:26 ` Takashi Yano
  0 siblings, 1 reply; 2+ messages in thread
From: Andrey Repin @ 2019-12-28  0:39 UTC (permalink / raw)
  To: All

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...\0РўТРРҐ\a&ц&ЖVТ\a&W\x06ч'G3ў\x02\x02\x02\x02\x02\x02\x06‡GG\x03ўтц7–wv–вж6цТч\a&ц&ЖVЧ2ж‡FЦАР¤d\x15\x13ў\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x06‡GG\x03ўтц7–wv–вж6цТцf\x17\x12рР¤Fц7VЦVзF\x17F–цгў\x02\x02\x02\x02\x02\x02\x02\x02\x06‡GG\x03ўтц7–wv–вж6цТцFц72ж‡FЦАРҐVз7V'67&–&R\x06–жfуў\x02\x02\x02\x02\x02\x06‡GG\x03ўтц7–wv–вж6цТцЦВт7Vз7V'67&–&RЧ6–Ч\x06ЖPР Р

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Cygwin 3.1 forcibly set wrong console code page
  2019-12-28  0:39 Cygwin 3.1 forcibly set wrong console code page Andrey Repin
@ 2019-12-28 12:26 ` Takashi Yano
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Yano @ 2019-12-28 12:26 UTC (permalink / raw)
  To: cygwin

On Fri, 27 Dec 2019 20:38:31 +0300
Andrey Repin wrote:
> 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??

Thanks for the report. I have found the cause in pty code.
I will submit a patch for this issue shortly.

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-12-28 11:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-28  0:39 Cygwin 3.1 forcibly set wrong console code page Andrey Repin
2019-12-28 12:26 ` Takashi Yano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).