Subject: bug#61934: 28.2; Exec format error when `default-directory` contains non-ASCII characters on Windows 11

From: "Grzegorz Kowzan" <[email-masked]>
Date: Fri, 03 Mar 2023 19:23:07 +0100

I changed the system code page globally and it is working now with directories containing my language's special characters.

Thank you for the help,
Grzegorz

On Fri, Mar 3, 2023, at 18:57, Grzegorz Kowzan wrote:
> Thank you for the explanation. Can the code page be changed from within 
> Emacs or is it set for good at startup? I tried changing the codepage 
> to cp1250, which can handle all the characters in the directory name, 
> with appropriate commands but I still get the same errors. When I 
> execute (describe-coding-system) I get:
>
> Coding system for saving this buffer:
>   Not set locally, use the default.
> Default coding system (for new files):
>   * -- windows-1250 (alias: cp1250)
>
> Coding system for keyboard input:
>   * -- windows-1250-unix (alias: cp1250-unix)
>
> Coding system for terminal output:
>   * -- cp1250 (alias of windows-1250)
>
> Coding system for inter-client cut and paste:
>   U -- utf-16le-dos
>
> Defaults for subprocess I/O:
>   decoding: * -- windows-1250-dos (alias: cp1250-dos)
>
>   encoding: * -- windows-1250-unix (alias: cp1250-unix)
>
> Priority order for recognizing coding systems when reading files:
>   1. windows-1250 (alias: cp1250)
>   2. utf-8 (alias: mule-utf-8 cp65001)
> ...
>
> which looks good to me. On the other hand, I did check that I can 
> execute commands from a directory named C:/þñÜ, which has characters 
> beyond ASCII that are handled by cp1252.
>
> Best regards,
> Grzegorz
>
> On Fri, Mar 3, 2023, at 15:41, Eli Zaretskii wrote:
>>> Date: Fri, 03 Mar 2023 14:56:32 +0100
>>> From: "Grzegorz Kowzan" <[email-masked]>
>>> 
>>> Calling external commands fails on Emacs under Windows 11 if
>>> `default-directory' contains non-ASCII characters. Steps to reproduce:
>>> 
>>> 0. Start emacs -Q
>>> 1. Create directory C:/zażółćgęśląjaźń.
>>> 2. Enter the directory with dired.
>>> 3. Press M-! and try executing any command.
>>> 4. Minibuffer shows error message: "Spawning child process: Exec format error"
>>
>> This is expected.  Emacs on Windows supports starting programs only if
>> the command-line arguments, including the program's file name, can be
>> encoded in the system's codepage.  According to this bug report, your
>> system codepage is 1252, and the file name you show cannot be encoded
>> using that codepage.
>>
>> This is a limitation of how Emacs on Windows invokes programs, but the
>> root cause is that many programs that run on Windows only support the
>> current codepage, and cannot support UTF-8 due to Windows misfeatures.
>>
>> Sorry.