unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* How to *force* a UTF-8 coding when visiting a file?
@ 2013-01-08 17:12 kj
  2013-01-08 17:36 ` Jambunathan K
       [not found] ` <mailman.16945.1357666615.855.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 3+ messages in thread
From: kj @ 2013-01-08 17:12 UTC (permalink / raw)
  To: help-gnu-emacs




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.

thanks in advance!


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to *force* a UTF-8 coding when visiting a file?
  2013-01-08 17:12 How to *force* a UTF-8 coding when visiting a file? kj
@ 2013-01-08 17:36 ` Jambunathan K
       [not found] ` <mailman.16945.1357666615.855.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 3+ messages in thread
From: Jambunathan K @ 2013-01-08 17:36 UTC (permalink / raw)
  To: help-gnu-emacs

kj <no.email@please.post> 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!
>

-- 



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to *force* a UTF-8 coding when visiting a file?
       [not found] ` <mailman.16945.1357666615.855.help-gnu-emacs@gnu.org>
@ 2013-01-08 20:13   ` kj
  0 siblings, 0 replies; 3+ messages in thread
From: kj @ 2013-01-08 20:13 UTC (permalink / raw)
  To: help-gnu-emacs

In <mailman.16945.1357666615.855.help-gnu-emacs@gnu.org> Jambunathan K <kjambunathan@gmail.com> writes:

>kj <no.email@please.post> 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'.
>| 
>`----


Exactly!  Thanks!


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-01-08 20:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-08 17:12 How to *force* a UTF-8 coding when visiting a file? kj
2013-01-08 17:36 ` Jambunathan K
     [not found] ` <mailman.16945.1357666615.855.help-gnu-emacs@gnu.org>
2013-01-08 20:13   ` kj

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).