When I run manage.py makemessages --all in some closed source Django project which uses docutils installed in virtualenv, I get this error:
Error: errors happened while running xgettext on lt.py
xgettext: ./venv/lib/python2.7/site-packages/docutils/parsers/rst/languages/lt.py:1: Unknown encoding "utf8". Proceeding with ASCII instead.
xgettext: Non-ASCII string at ./venv/lib/python2.7/site-packages/docutils/parsers/rst/languages/lt.py:21.
Please specify the source encoding through --from-code or through a comment
as specified in http://www.python.org/peps/pep-0263.html.
While Python itself is liberate enough on # encoding header, by standard proper name of UTF-8 includes dash.
Please, accept this patch that changes coding header to utf-8 with dash. It fixes my problem.
I agree that a consistent naming is preferable and will change the comments to
"coding: utf-8". -> Done in revision 7668
However, please consider a bug report to the used Python variant, as both
utf8 and utf-8 are valid aliases for the codec "utf_8".
(I cannot see a preference for an alias with hyphen in
http://docs.python.org/2/library/codecs.html)