help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: How to *force* a UTF-8 coding when visiting a file?


From: Jambunathan K
Subject: Re: How to *force* a UTF-8 coding when visiting a file?
Date: Tue, 08 Jan 2013 23:06:35 +0530
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

kj <address@hidden> writes:

> Short of adding "-*- coding: utf-8 -*-" to the beginning of a file,
> is there a way to *force* Emacs to assume a UTF-8 coding?
>
> I have found that slight corruptions to a file can easily throw
> off whatever heuristics Emacs uses to guess a file's encoding.
> For such situations it would be useful to be able to tell Emacs
> explicitly what coding to use when visiting a file.  IOW, I'm
> looking for the "unobtrusive" equivalent to adding "-*- coding:
> utf-8 -*-" at the beginning of the file.




,---- (info "(emacs) Specify Coding")
|
| 22.8 Specifying a File's Coding System
| ======================================
| 
| If Emacs recognizes the encoding of a file incorrectly, you can reread
| the file using the correct coding system with `C-x <RET> r'
| (`revert-buffer-with-coding-system').  This command prompts for the
| coding system to use.  To see what coding system Emacs actually used to
| decode the file, look at the coding system mnemonic letter near the
| left edge of the mode line (*note Mode Line::), or type `C-h C'
| (`describe-coding-system').
| 
|    You can specify the coding system for a particular file in the file
| itself, using the `-*-...-*-' construct at the beginning, or a local
| variables list at the end (*note File Variables::).  You do this by
| defining a value for the "variable" named `coding'.  Emacs does not
| really have a variable `coding'; instead of setting a variable, this
| uses the specified coding system for the file.  For example, `-*-mode:
| C; coding: latin-1;-*-' specifies use of the Latin-1 coding system, as
| well as C mode.  When you specify the coding explicitly in the file,
| that overrides `file-coding-system-alist'.
| 
`----


>
> thanks in advance!
>

-- 



reply via email to

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