[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: set UTF-8 for a file (HTML)

From: Tim X
Subject: Re: set UTF-8 for a file (HTML)
Date: Sun, 10 Feb 2008 15:04:23 +1100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux)

ken <address@hidden> 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

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


tcross (at) rapttech dot com dot au

reply via email to

[Prev in Thread] Current Thread [Next in Thread]