From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tim X Newsgroups: gmane.emacs.help Subject: Re: set UTF-8 for a file (HTML) Date: Sun, 10 Feb 2008 15:04:23 +1100 Organization: Rapt Technologies Message-ID: <87myq9h2yg.fsf@lion.rapttech.com.au> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1202618444 22683 80.91.229.12 (10 Feb 2008 04:40:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 10 Feb 2008 04:40:44 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Feb 10 05:41:05 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JO401-0005od-CY for geh-help-gnu-emacs@m.gmane.org; Sun, 10 Feb 2008 05:41:05 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JO3zY-0006Ou-CO for geh-help-gnu-emacs@m.gmane.org; Sat, 09 Feb 2008 23:40:36 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!newsfeed.gamma.ru!Gamma.RU!sn-xt-sjc-02!sn-xt-sjc-06!sn-post-sjc-01!supernews.com!corp.supernews.com!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux) Cancel-Lock: sha1:NNpM3GX78L+Cln2s1xnBGOt8ZVc= Original-X-Complaints-To: abuse@supernews.com Original-Lines: 40 Original-Xref: shelby.stanford.edu gnu.emacs.help:156018 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:51396 Archived-At: ken 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