I have a bunch of html files encoded as iso-8859-1-unix and a few encoded in utf-8-unix. What I want is to encode all of them in utf-8-unix. I have already tried (I think they are the same command, actually):
C-x C-m f utf-8-unix
C-x RET f utf-8-unix
the modeline changes from 1 to U, but after I close the file and reopen it, the modeline shows 1 again. It seems that I cannot make the change permanent no matter what I try and I don't understand why.
Following the suggestions below, I have created a new file with this content
<ul class="navbar">
<li><a href="index.php">home</a></li>
<li><a href="bio.php">bio</a></li>
<li><a href="research.php">research</a></li>
<li><a href="software.php">software</a></li>
<li><a href="contacts.php">contacts</a></li>
</ul>
C-h v buffer-file-coding-system
returns this:
Its value is utf-8-unix
Local in buffer new.htm; global value is the same.
so it looks okay. I save, kill the buffer, reopen the file and C-h v buffer-file-coding-system
returns this:
Its value is undecided-unix
Local in buffer new.htm; global value is utf-8-unix
I am really confused.
EDIT: thanks everybody for helping making this clear!
C-h v coding RET
you must issue this command in that buffer. Maybe there is a special character forcing Emacs think the file has in a particular coding. Or maybe you have something in your init file.buffer-file-coding-system
variable<head>
section of your HTML file contains<meta charset='utf-8'>
, then html-mode should use that to decide the encoding when you open the file. No need to use file local variables in this case.