X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:date:from:reply-to:message-id:to:subject
	:mime-version:content-type:content-transfer-encoding; q=dns; s=
	default; b=SE0eU6hJcqM2C6gKT/uzkvlg6l0OhR7r399bDCGLoUcbOzqv/vdR0
	5kbxBX9JocHLPR9AQ2nF9KJy9Bovc6GxL2a+JW5zDDjCgM3PuKkN4liQgRayT0ad
	KqRG2y1D0T1UlaJgmzknVsYTtlwJDFtSixVrwegVlLEKxQx1Y0vbtA=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:date:from:reply-to:message-id:to:subject
	:mime-version:content-type:content-transfer-encoding; s=default;
	 bh=TcaUVT6LMSoGKNBRwgP+H5QKQHM=; b=iGCjq5GKYoxXzJWHWkuenp4bwsms
	jVQsoEgdNF0wP6tN43Cmtloh/ZjGjbQ4Om6B6aMx+rGZlql5AWweVRYZ1NsgLBDQ
	H1xo+c90OLi/dgloymVgm5bSdU4zpO3dYb9OXqoKZJCGb8vkwqi8N59MSfwGFyi9
	oxVQIPfVLZrZNpo=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=3.3 required=5.0 tests=BAYES_00,BODY_8BITS,FREEMAIL_FROM,GARBLED_BODY,KAM_THEBAT,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=no version=3.3.1 spammy=H*MI:yandex, username, login, USER
X-HELO: forward106j.mail.yandex.net
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1577469002;	bh=/LCaF746gJrNbSjhrjiL8BMzPqjhDWdkOnxUlsqXCvs=;	h=Subject:To:Reply-To:From:Message-ID:Date;	b=pcijciV9DAa2AjDNOqXo2s1sOH8j4KqswIQ1Ha/OKNd85xULM3rGr7P+493Dva73b	 oMuGlrCG5QgPpFxuHjp2D4ifpWXgEgf4hqkmG9l3e+V/zvNFT/kOHbz2aIBeeS0qCR	 qhwky7V97mxmrVr3nYy/RuW92dJ3b/Yhu+XWuw+s=
Authentication-Results: mxback4q.mail.yandex.net; dkim=pass header.i=@yandex.ru
Date: Fri, 27 Dec 2019 20:38:31 +0300
From: Andrey Repin <anrdaemon@yandex.ru>
Reply-To: cygwin@cygwin.com
Message-ID: <1369669088.20191227203831@yandex.ru>
To: All <cygwin@cygwin.com>
Subject: Cygwin 3.1 forcibly set wrong console code page
MIME-Version: 1.0
Content-Type: text/plain; charset=windows-1251
X-IsSubscribed: yes
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id xBRHoghK032599

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...
--
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


