[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: the -*-coding: -*- stuff doesn't check for invalid codings
From: |
Juanma Barranquero |
Subject: |
Re: the -*-coding: -*- stuff doesn't check for invalid codings |
Date: |
Thu, 14 Jul 2005 22:00:38 +0200 |
On 7/14/05, Kevin Rodgers <ihs_4664@yahoo.com> wrote:
> I think it would be better to signal an error there than to fall back on
> the default coding system, since the author of the file clearly intends
> that a specific coding system be used.
>From the Python docs:
"If a comment in the first or second line of the Python script matches
the regular expression coding[=:]\s*([-\w.]+), this comment is
processed as an encoding declaration; the first group of this
expression names the encoding of the source code file. The recommended
forms of this expression are
# -*- coding: <encoding-name> -*-
which is recognized also by GNU Emacs, and
# vim:fileencoding=<encoding-name>
which is recognized by Bram Moolenaar's VIM."
The Python encodings are largely those of Emacs, but with some
differences. For example, coding: latin_1 is valid for Python,
unrecognized by Emacs.
Not sure whether this is an argument for throwing an error, or adding
more aliases to Emacs encodings, though.
--
/L/e/k/t/u