* set UTF-8 for a file (HTML)
@ 2008-02-10 1:59 ken
2008-02-10 9:03 ` Peter Dyballa
0 siblings, 1 reply; 4+ messages in thread
From: ken @ 2008-02-10 1:59 UTC (permalink / raw)
To: help-gnu-emacs
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?
Thanks.
--
The significant problems we face cannot be solved at the
same level of thinking we were at when we created them.
-- Albert Einstein
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: set UTF-8 for a file (HTML)
2008-02-10 1:59 set UTF-8 for a file (HTML) ken
@ 2008-02-10 9:03 ` Peter Dyballa
0 siblings, 0 replies; 4+ messages in thread
From: Peter Dyballa @ 2008-02-10 9:03 UTC (permalink / raw)
To: ken; +Cc: help-gnu-emacs
Am 10.02.2008 um 02:59 schrieb ken:
> So what should this line say to specify that the file is encoded in
> utf-8?
At the beginning of the file it would look like:
;;; -*- mode: Text; coding: utf-8; -*-
You would need to substitute the three ``;´´ with a comment
character in HTML, and you would need to leave away the ``mode: Text;
´´ part or substitute it with the proper mode.
--
Greetings
Pete
»¿ʇı̣ əsnqɐ ʇ,uɐɔ noʎ ɟı̣
ɓuı̣ɥʇʎuɐ sı̣ pooɓ ʇɐɥʍ«
^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <mailman.7237.1202608828.18990.help-gnu-emacs@gnu.org>]
* Re: set UTF-8 for a file (HTML)
[not found] <mailman.7237.1202608828.18990.help-gnu-emacs@gnu.org>
@ 2008-02-10 4:04 ` Tim X
2008-02-10 9:04 ` Harald Hanche-Olsen
1 sibling, 0 replies; 4+ messages in thread
From: Tim X @ 2008-02-10 4:04 UTC (permalink / raw)
To: help-gnu-emacs
ken <gebser@speakeasy.net> writes:
> 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?
>
What version of emacs are you running? Emacs 22 has much better utf-8
support than earlier versions.
The coding used/preferred by emacs is influenced by your locale
setting. If your not running a utf-8 locale, you probably will need to
set some variables (easiest via customize). What variables depends on
the version of emacs your running.
In emacs 22, if you have a utf-8 locale set, emacs will use that as its
preferred coding and you shouldn't need to do anything unless the file
has already been created in another coding system. Emacs works quite
hard to try and not change the coding used on any file it
edits. Creating a new file will use the default/preferred coding and if
you have'nt set that manually, will default to what your locale setting
is.
I do have the following in my .emacs
'(current-language-environment "UTF-8")
and a locale setting of en_AU.utf-8
Note that in emacs22 you can tell if emacs is using a utf-8 encoding by
the existance of a 'u' in the mode line (left hand side, second
character).
Tim
--
tcross (at) rapttech dot com dot au
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: set UTF-8 for a file (HTML)
[not found] <mailman.7237.1202608828.18990.help-gnu-emacs@gnu.org>
2008-02-10 4:04 ` Tim X
@ 2008-02-10 9:04 ` Harald Hanche-Olsen
1 sibling, 0 replies; 4+ messages in thread
From: Harald Hanche-Olsen @ 2008-02-10 9:04 UTC (permalink / raw)
To: help-gnu-emacs
+ 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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-02-10 9:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-10 1:59 set UTF-8 for a file (HTML) ken
2008-02-10 9:03 ` Peter Dyballa
[not found] <mailman.7237.1202608828.18990.help-gnu-emacs@gnu.org>
2008-02-10 4:04 ` Tim X
2008-02-10 9:04 ` Harald Hanche-Olsen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).