[openstack-dev] Specifying file encoding

Martin Geisler martin at geisler.net
Wed May 28 07:16:11 UTC 2014


Hi everybody,

I'm trying to get my feet wet with OpenStack development, so I recently
tried to submit some small patches. One small thing I noticed was that
some files used

  # -*- encoding: utf-8 -*-

to specify the file encoding for both Python and Emacs. Unfortunately,
Emacs expects you to set "coding", not "encoding". Python is fine with
either. I submitted a set of patches for this:

* https://review.openstack.org/95862
* https://review.openstack.org/95864
* https://review.openstack.org/95865
* https://review.openstack.org/95869
* https://review.openstack.org/95871
* https://review.openstack.org/95880
* https://review.openstack.org/95882
* https://review.openstack.org/95886

It was pointed out to me that such a change ought to be coordinated
better via bug(s) or the mailinglist, so here I am :)

It was also suggested that the lines should be removed completely with a
reference to this thread:

  http://lists.openstack.org/pipermail/openstack-dev/2013-October/017353.html

Unfortunately, the issue is only somewhat similar: the thread is about
removing Vim modelines:

  # vim: tabstop=4 shiftwidth=4 softtabstop=4

My patches is about using an Emacs-friendly way to specify the file
encoding. PEP 263 (http://legacy.python.org/dev/peps/pep-0263/) explains
that is it a SyntaxError not to specify an encoding when a file has
non-ASCII characters.

Many of the files (but not all) have a © copyright symbol in the file
header and so the encoding line cannot be removed from these files
unless the copyright symbol is removed at the same time.

I saw references to "hacking" in the Vim modeline thread. At first I
thought it might be a tool used to check the style, but now I think it
migth just be this document:

  http://docs.openstack.org/developer/hacking/


I look forward to hearing your comments!

-- 
Martin Geisler

https://plus.google.com/+MartinGeisler/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20140528/ade5de3f/attachment.pgp>


More information about the OpenStack-dev mailing list