[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: call-process -> insert -> iso-latin-1-dos problem on Windows
From: |
Stefan Monnier |
Subject: |
Re: call-process -> insert -> iso-latin-1-dos problem on Windows |
Date: |
Sun, 14 Jan 2024 20:25:54 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
> I have a function called `find-wget' that works well in *NIX-like
> systems - it calls wget, puts the output in the temporary buffer, and
> on unices Emacs always chooses the right encoding... but when I run it
> on Windows, and I call wget like this,
>
> wget -q -O - http://anggtwu.net/LUA/Dang1.lua
>
> where Dang1.lua is a file in UTF-8, then Emacs switches the encoding
> of output buffer to iso-latin-1-dos...
Most current POSIX systems use UTF-8 encoding by default.
AFAIK This is not the case under Windows.
> I probably wrote my code relying in undefined behaviors...
You generally need to tell Emacs what's the (expected) encoding of
a process's output. Emacs generally assumes it's "the system's default"
if not, but that's bound to be wrong every once in a while.
You can do that by let-binding `coding-system-for-read`,
`process-coding-system-alist`, or `default-process-coding-system` around
the call to `call-process`.
For async processes you can do it more directly by passing a `:coding`
arg to to `make-process`.
Stefan