From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Gerald Wildgruber Newsgroups: gmane.emacs.help Subject: How to make emacs auto-recognize utf-8 encoded files upon visiting Date: 23 Sep 2002 18:39:19 +0200 Organization: T-Online Sender: help-gnu-emacs-admin@gnu.org Message-ID: Reply-To: Gerald Wildgruber NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1032800183 29269 127.0.0.1 (23 Sep 2002 16:56:23 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 23 Sep 2002 16:56:23 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 17tWVR-0007bw-00 for ; Mon, 23 Sep 2002 18:56:21 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 17tWVR-00008L-00; Mon, 23 Sep 2002 12:56:21 -0400 Original-Path: shelby.stanford.edu!nntp.stanford.edu!newsfeed.stanford.edu!newsfeed.berkeley.edu!news-hog.berkeley.edu!ucberkeley!nntp-relay.ihug.net!ihug.co.nz!newsfeed00.sul.t-online.de!newsmm00.sul.t-online.com!t-online.de!news.t-online.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 31 Original-X-Trace: news.t-online.com 1032799285 06 3018 RkfxbvKSCAnty 020923 16:41:25 Original-X-Complaints-To: abuse@t-online.com X-Sender: 520037909364-0001@t-dialin.net User-Agent: Gnus/5.090003 (Oort Gnus v0.03) Emacs/21.3.50 Original-Xref: nntp.stanford.edu gnu.emacs.help:105192 Original-To: help-gnu-emacs@gnu.org Errors-To: help-gnu-emacs-admin@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.help:1747 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:1747 Hello, I'm trying to make my emacs (GNU Emacs 21.3.50.1 on linux) auto-recognize the right encoding when visiting files with utf-8 encoding. The emacs info help entry says on the topic: "Some coding systems can be recognized or distinguished by which byte sequences appear in the data. However, there are coding systems that cannot be distinguished, not even potentially." Does this also apply to utf-8 encoded files? Is it impossible for emacs to auto-recognize them (as for example the `file' command on the shell does)? I'm aware of how to do this with File Variables (either by using the `-*-...-*-' construct or a local variables list at the end of the file). Both of them work well. Setting `(prefer-coding-system 'utf-8)' in `.emacs' also works, but is kind of intrusive as all new files are then using this encoding by default. Even without file variables, Emacs does correctly recognize the encoding when visiting latin-1 or latin-9 encoded files. Yet it fails when visiting utf-8 encoded files. I get the `-:--' abbrev on the encoding part of the modeline, and letters beyond ascii are messed up. Can anyone give me a hint on how to make emacs find the correct coding system (without setting it explicitly through file variables)? Thanks, Gerald.