Subject: 27.1; windows mangles encoding on command line

From: Wayne Harris <[email-masked]>
Date: Mon, 03 Oct 2022 22:18:35 -0300

I run emacs -Q.  I open eshell.  Then I try to use fossil (which is a
version control system like git) and try to put accented letters on the
commit message.  No choice of encoding seems to avoid the mangling.

c:/my/path $ alias fs 'fossil $*'
c:/my/path $ echo kkk >> encoding.txt 
c:/my/path $ fs changes
EDITED     encoding.txt

c:/my/path $ (print default-process-coding-system)
(undecided-dos . undecided-unix)

c:/my/path $ (or buffer-file-coding-system "it is nil")
it is nil

c:/my/path $ fs commit -m 'Naiveté'
[...]
Sync done, wire bytes sent: 3234  received: 309  ip: 5.161.138.46

c:/my/path $ fs timeline -n 1
=== 2022-10-02 ===
13:11:20 [febbbf0441] *CURRENT* NaivetÃ© (user: mer tags: trunk)
--- entry limit (1) reached ---
c:/my/path $ 

Commit message has been mangled.  I then tried to set the ESHELL buffer
to utf-8 to no avail.  Eli Zaretskii kindly helped me to investigate
this in the [email-masked] maillist.  First message was 

  <[email-masked]>

with subject 

  on ESHELL, utf-8 and fossil command-line commit message

--8<---------------cut here---------------start------------->8---
> Who is mangling my command-line arguments and why?  Thank you!

You cannot use UTF-8 for encoding command-line arguments of
subprocesses on MS-Windows.  Use your system's codepage instead.  This
means make sure the Eshell buffer's value of buffer-file-coding-system
is your system codepage, not UTF-8.
--8<---------------cut here---------------end--------------->8---

In GNU Emacs 27.1 (build 1, x86_64-w64-mingw32)
 of 2020-08-21 built on CIRROCUMULUS
Repository revision: 86d8d76aa36037184db0b2897c434cdaab1a9ae8
Repository branch: HEAD
Windowing system distributor 'Microsoft Corp.', version 10.0.19041
System Description: Microsoft Windows 10 Enterprise (v10.0.2004.19041.388)

Configured using:
 'configure --without-dbus --host=x86_64-w64-mingw32
 --without-compress-install 'CFLAGS=-O2 -static''

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY W32NOTIFY ACL GNUTLS LIBXML2
HARFBUZZ ZLIB TOOLKIT_SCROLL_BARS MODULES THREADS JSON PDUMPER LCMS2 GMP

Important settings:
  value of $LC_ALL: C
  value of $LANG: en_US
  locale-coding-system: cp1252

Major mode: Article

Minor modes in effect:
  shell-dirtrack-mode: t
  electric-pair-mode: t
  show-paren-mode: t
  recentf-mode: t
  save-place-mode: t
  winner-mode: t
  display-time-mode: t
  global-eldoc-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
c:/sys/emacs/usr/.emacs.d/elpa/pos-tip-20191227.1356/pos-tip hides c:/sys/emacs/share/emacs/site-lisp/my-pos-tip/pos-tip
c:/sys/emacs/usr/.emacs.d/elpa/pos-tip-20191227.1356/pos-tip-pkg hides c:/sys/emacs/share/emacs/site-lisp/my-pos-tip/pos-tip-pkg
c:/sys/emacs/usr/.emacs.d/elpa/pos-tip-20191227.1356/pos-tip-autoloads hides c:/sys/emacs/share/emacs/site-lisp/my-pos-tip/pos-tip-autoloads
c:/sys/emacs/usr/.emacs.d/elpa/racket-mode-20201022.1304/racket-xp hides c:/sys/emacs/share/emacs/site-lisp/my-racket-mode/racket-xp
c:/sys/emacs/usr/.emacs.d/elpa/racket-mode-20201022.1304/racket-xp-complete hides c:/sys/emacs/share/emacs/site-lisp/my-racket-mode/racket-xp-complete
c:/sys/emacs/usr/.emacs.d/elpa/racket-mode-20201022.1304/racket-wsl hides c:/sys/emacs/share/emacs/site-lisp/my-racket-mode/racket-wsl
c:/sys/emacs/usr/.emacs.d/elpa/racket-mode-20201022.1304/racket-visit hides c:/sys/emacs/share/emacs/site-lisp/my-racket-mode/racket-visit
c:/sys/emacs/usr/.emacs.d/elpa/racket-mode-20201022.1304/racket-util hides c:/sys/emacs/share/emacs/site-lisp/my-racket-mode/racket-util
c:/sys/emacs/usr/.emacs.d/elpa/racket-mode-20201022.1304/racket-unicode-input-method hides c:/sys/emacs/share/emacs/site-lisp/my-racket-mode/racket-unicode-input-method
c:/sys/emacs/usr/.emacs.d/elpa/racket-mode-20201022.1304/racket-stepper hides c:/sys/emacs/share/emacs/site-lisp/my-racket-mode/racket-stepper
c:/sys/emacs/usr/.emacs.d/elpa/racket-mode-20201022.1304/racket-smart-open hides c:/sys/emacs/share/emacs/site-lisp/my-racket-mode/racket-smart-open
c:/sys/emacs/usr/.emacs.d/elpa/racket-mode-20201022.1304/racket-show hides c:/sys/emacs/share/emacs/site-lisp/my-racket-mode/racket-show
c:/sys/emacs/usr/.emacs.d/elpa/racket-mode-20201022.1304/racket-repl hides c:/sys/emacs/share/emacs/site-lisp/my-racket-mode/racket-repl
c:/sys/emacs/usr/.emacs.d/elpa/racket-mode-20201022.1304/racket-repl-buffer-name hides c:/sys/emacs/share/emacs/site-lisp/my-racket-mode/racket-repl-buffer-name
c:/sys/emacs/usr/.emacs.d/elpa/racket-mode-20201022.1304/racket-profile hides c:/sys/emacs/share/emacs/site-lisp/my-racket-mode/racket-profile
c:/sys/emacs/usr/.emacs.d/elpa/racket-mode-20201022.1304/racket-ppss hides c:/sys/emacs/share/emacs/site-lisp/my-racket-mode/racket-ppss
c:/sys/emacs/usr/.emacs.d/elpa/racket-mode-20201022.1304/racket-parens hides c:/sys/emacs/share/emacs/site-lisp/my-racket-mode/racket-parens
c:/sys/emacs/usr/.emacs.d/elpa/racket-mode-20201022.1304/racket-mode hides c:/sys/emacs/share/emacs/site-lisp/my-racket-mode/racket-mode
c:/sys/emacs/usr/.emacs.d/elpa/racket-mode-20201022.1304/racket-logger hides c:/sys/emacs/share/emacs/site-lisp/my-racket-mode/racket-logger
c:/sys/emacs/usr/.emacs.d/elpa/racket-mode-20201022.1304/racket-keywords-and-builtins hides c:/sys/emacs/share/emacs/site-lisp/my-racket-mode/racket-keywords-and-builtins
c:/sys/emacs/usr/.emacs.d/elpa/racket-mode-20201022.1304/racket-indent hides c:/sys/emacs/share/emacs/site-lisp/my-racket-mode/racket-indent
c:/sys/emacs/usr/.emacs.d/elpa/racket-mode-20201022.1304/racket-imenu hides c:/sys/emacs/share/emacs/site-lisp/my-racket-mode/racket-imenu
c:/sys/emacs/usr/.emacs.d/elpa/racket-mode-20201022.1304/racket-font-lock hides c:/sys/emacs/share/emacs/site-lisp/my-racket-mode/racket-font-lock
c:/sys/emacs/usr/.emacs.d/elpa/racket-mode-20201022.1304/racket-eldoc hides c:/sys/emacs/share/emacs/site-lisp/my-racket-mode/racket-eldoc
c:/sys/emacs/usr/.emacs.d/elpa/racket-mode-20201022.1304/racket-edit hides c:/sys/emacs/share/emacs/site-lisp/my-racket-mode/racket-edit
c:/sys/emacs/usr/.emacs.d/elpa/racket-mode-20201022.1304/racket-doc hides c:/sys/emacs/share/emacs/site-lisp/my-racket-mode/racket-doc
c:/sys/emacs/usr/.emacs.d/elpa/racket-mode-20201022.1304/racket-describe hides c:/sys/emacs/share/emacs/site-lisp/my-racket-mode/racket-describe
c:/sys/emacs/usr/.emacs.d/elpa/racket-mode-20201022.1304/racket-debug hides c:/sys/emacs/share/emacs/site-lisp/my-racket-mode/racket-debug
c:/sys/emacs/usr/.emacs.d/elpa/racket-mode-20201022.1304/racket-custom hides c:/sys/emacs/share/emacs/site-lisp/my-racket-mode/racket-custom
c:/sys/emacs/usr/.emacs.d/elpa/racket-mode-20201022.1304/racket-complete hides c:/sys/emacs/share/emacs/site-lisp/my-racket-mode/racket-complete
c:/sys/emacs/usr/.emacs.d/elpa/racket-mode-20201022.1304/racket-common hides c:/sys/emacs/share/emacs/site-lisp/my-racket-mode/racket-common
c:/sys/emacs/usr/.emacs.d/elpa/racket-mode-20201022.1304/racket-collection hides c:/sys/emacs/share/emacs/site-lisp/my-racket-mode/racket-collection
c:/sys/emacs/usr/.emacs.d/elpa/racket-mode-20201022.1304/racket-cmd hides c:/sys/emacs/share/emacs/site-lisp/my-racket-mode/racket-cmd
c:/sys/emacs/usr/.emacs.d/elpa/racket-mode-20201022.1304/racket-bug-report hides c:/sys/emacs/share/emacs/site-lisp/my-racket-mode/racket-bug-report
c:/sys/emacs/usr/.emacs.d/elpa/racket-mode-20201022.1304/racket-browse-url hides c:/sys/emacs/share/emacs/site-lisp/my-racket-mode/racket-browse-url
c:/sys/emacs/usr/.emacs.d/elpa/seq-2.23/seq hides c:/sys/emacs/share/emacs/27.1/lisp/emacs-lisp/seq

Features:
(shadow emacsbug sendmail qp gnus-html help-fns radix-tree url-cache
vc-git diff-mode mhtml-mode css-mode smie eww mm-url url-queue color js
imenu cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align
cc-engine cc-vars cc-defs sgml-mode pcmpl-unix em-unix em-term term
ehelp em-script em-prompt em-ls em-hist em-pred em-glob em-dirs esh-var
em-cmpl em-basic em-banner em-alias esh-mode eshell esh-cmd esh-ext
esh-opt esh-proc esh-io esh-arg esh-module esh-groups esh-util ibuf-ext
ibuffer ibuffer-loaddefs mm-archive pp canlock warnings nnir mule-util
sort gnus-cite mail-extr gnus-async gnus-bcklg gnus-ml nndraft nnmh
nnfolder gnus-agent gnus-srvr gnus-score score-mode nnvirtual gnus-msg
gnus-art mm-uu mml2015 mm-view mml-smime smime dig gnus-cache gnus-sum
url url-proxy url-privacy url-expand url-methods url-history mailcap shr
url-cookie url-domsuf url-util svg xml dom gnutls network-stream nsm
nntp gnus-group gnus-undo cl gnus-start gnus-cloud nnimap nnmail
mail-source utf7 netrc nnoo gnus-spec gnus-int gnus-range message rmc
puny dired dired-loaddefs rfc822 mml mml-sec epa derived epg epg-config
mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
mailheader gnus-win gnus nnheader gnus-util rmail rmail-loaddefs rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils rx text-property-search
thingatpt compile cl-extra help-mode python tramp-sh tramp
tramp-loaddefs trampver tramp-integration files-x tramp-compat shell
pcomplete parse-time iso8601 format-spec comint ansi-color misearch
multi-isearch time-date paredit edmacro kmacro easy-mmode finder-inf
info elec-pair paren recentf tree-widget wid-edit saveplace winner ring
windmove server time my package easymenu browse-url url-handlers
url-parse auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs
password-cache json subr-x map url-vars seq byte-opt gv bytecomp
byte-compile cconv cl-loaddefs cl-lib tooltip eldoc electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel dos-w32 ls-lisp disp-table
term/w32-win w32-win w32-vars term/common-win tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode
lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch
timer select scroll-bar mouse jit-lock font-lock syntax facemenu
font-core term/tty-colors frame minibuffer cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote threads w32notify w32
lcms2 multi-tty make-network-process emacs)

Memory information:
((conses 16 446989 94601)
 (symbols 48 29224 2)
 (strings 32 128086 11600)
 (string-bytes 1 3901474)
 (vectors 16 51405)
 (vector-slots 8 2463639 186586)
 (floats 8 535 466)
 (intervals 56 16557 934)
 (buffers 1000 64))