Subject: bug#46171: 27.1; buffer-file-coding-system

From: Eli Zaretskii <[email-masked]>
Date: Fri, 29 Jan 2021 15:58:49 +0200

> Date: Fri, 29 Jan 2021 12:14:45 +0000
> From: daniel-f.gordillo--- via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <[email-masked]>
> 
> In Emacs for Windows: I opened a SQL generated file with coding utf-8,
> but it's identified as iso-latin-1 (but it's not true). The same file,
> in Emacs for gnu/Linux, it's identified as utf-8.

It isn't always possible to identify the UTF-8 encoding, so when the
default of the locale is not UTF-8 (and it never is on MS-Windows),
Emacs sometimes guesses wrong.

To work around this, if you know the file is encoded in UTF-8, you can
tell Emacs about that:

  C-x RET c utf-8 RET C-x C-f <the-file> RET

OTOH, if SQL files are always encoded in UTF-8 (are they?), we can add
this knowledge to Emacs, assuming these files have some known
file-name extension, or have some telltale string at their beginning.