unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* command line parsing on windows and the right encoding
@ 2022-02-19 17:40 Andrés Ramírez
  2022-02-19 17:56 ` Eli Zaretskii
  0 siblings, 1 reply; 2+ messages in thread
From: Andrés Ramírez @ 2022-02-19 17:40 UTC (permalink / raw)
  To: emacs-devel

Hi.

Reading this blogpost.
,---- [ https://nullprogram.com/blog/2022/02/18/ ]
| The aged Emacs implementation is written in C rather than Lisp, steeped in history with
|  vestigial wrong turns. Emacs still only calls the “narrow” CreateProcessA despite having
|  every affordance to do otherwise, and uses the wrong encoding at that. A personal source of
|  headaches.
`----

There is a couple of doubts:
1. Should emacs replace CreateProcessA with CreateProcessW?
2. How Could the emacs-windows port have the right encoding when parsing
command line arguments?

Best Regards



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

* Re: command line parsing on windows and the right encoding
  2022-02-19 17:40 command line parsing on windows and the right encoding Andrés Ramírez
@ 2022-02-19 17:56 ` Eli Zaretskii
  0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2022-02-19 17:56 UTC (permalink / raw)
  To: Andrés Ramírez; +Cc: emacs-devel

> From: Andrés Ramírez <rrandresf@gmail.com>
> Date: Sat, 19 Feb 2022 17:40:55 +0000
> 
> Hi.
> 
> Reading this blogpost.
> ,---- [ https://nullprogram.com/blog/2022/02/18/ ]
> | The aged Emacs implementation is written in C rather than Lisp, steeped in history with
> |  vestigial wrong turns. Emacs still only calls the “narrow” CreateProcessA despite having
> |  every affordance to do otherwise, and uses the wrong encoding at that. A personal source of
> |  headaches.
> `----
> 
> There is a couple of doubts:
> 1. Should emacs replace CreateProcessA with CreateProcessW?

We can't usefully do that, because (almost) all programs we invoke as
sub-processes don't use "wide" (a.k.a. "Unicode") APIs to access their
command-line arguments, so even if we used CreateProcessW, Windows
would convert the UTF-16 encoded arguments to the locale's
environment, and ruin what we did.

Using CreateProcessA at least lets us signal an error when the
command-line arguments cannot be encoded in the locale's encoding.

> 2. How Could the emacs-windows port have the right encoding when parsing
> command line arguments?

We already do.  We use the locale's preferred encoding by default, and
let Lisp programs override that by binding coding-system-for-write.



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

end of thread, other threads:[~2022-02-19 17:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-19 17:40 command line parsing on windows and the right encoding Andrés Ramírez
2022-02-19 17:56 ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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