[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: set UTF-8 for a file (HTML)
From: |
Harald Hanche-Olsen |
Subject: |
Re: set UTF-8 for a file (HTML) |
Date: |
Sun, 10 Feb 2008 10:04:56 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix) |
+ ken <gebser@speakeasy.net>:
> I'm editing an HTML file (in emacs, of course) and want to preserve
> the utf-8 encoding when the file is opened in subsequent sessions. I
> know I can put a line at the top of the file which will set a variable
> in emacs whenever the file is opened. So what should this line say to
> specify that the file is encoded in utf-8?
If you're using HTML mode, just specifying
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
in the head element of the file should do it.
Otherwise, a generic method for specifying the coding to emacs is
having -*- coding: utf-8 -*- in the first line of the file. You should
typically protect that by putting in a comment, as follows:
<!-- -*- coding: utf-8 -*- -->
--
* Harald Hanche-Olsen <URL:http://www.math.ntnu.no/~hanche/>
- It is undesirable to believe a proposition
when there is no ground whatsoever for supposing it is true.
-- Bertrand Russell