Downcase UTF-8 file encoding name
Python and Emacs (and others?) recognize a special directive line in a file that identifies what encoding the file is encoded in. See Python PEP 263. For example: The general form of the directive is: where xxx is the name of a codec. Python codec names are lower case with underscores used to seperate words. In both Python and Emacs one can create aliases for the codecs so you can use an alternate name to refer to the same codec. Python is forgiving with respect to case, underscore and hyphens. Python will automatically create an alias for a codec name by downcasing it and replacing hyphens with underscores, thus "UTF-8" is actually an alias for the "utf_8" codec. Unfortunately emacs does not automatically create such aliases, although one can add aliases via a custom initialization file, but doing so requires every user using emacs to edit the files to manually create their own aliases. If you try to write a file in emacs with the "UTF-8" codec name it won't recognize it as "utf-8", instead you'll get errors like this: Warning (mule): Invalid coding system ‘UTF-8’ is specified for the current buffer/file by the :coding tag. It is highly recommended to fix it before writing to a file. and you must force the file to be written by responding to additional propmpts. This patch simply downcases the the "UTF-8" codec name to "utf-8" so that both Python and Emacs will accept the codec name. License: MIT Signed-off-by: John Dennis <jdennis@redhat.com>
This commit is contained in:
parent
2ca0303524
commit
a76390813a
|
@ -1,4 +1,4 @@
|
|||
# -*- coding: UTF-8 -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# $Id: XmlTestRunner.py 3254 2007-06-05 21:23:57Z fpeters $
|
||||
#
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#! /usr/bin/env python
|
||||
# -*- coding: UTF-8 -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# $Id: binding_tests.py 3283 2007-06-11 09:10:18Z dlaniel $
|
||||
#
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#! /usr/bin/env python
|
||||
# -*- coding: UTF-8 -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Python unit tests for Lasso library
|
||||
#
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#! /usr/bin/env python
|
||||
# -*- coding: UTF-8 -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# $Id: idwsf2_tests.py 3254 2007-06-05 21:23:57Z dlaniel $
|
||||
#
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#! /usr/bin/env python
|
||||
# -*- coding: UTF-8 -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# $Id: profiles_tests.py 3254 2007-06-05 21:23:57Z fpeters $
|
||||
#
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#! /usr/bin/env python
|
||||
# -*- coding: UTF-8 -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# $Id: tests.py 3425 2007-10-10 09:31:03Z dlaniel $
|
||||
#
|
||||
|
|
Loading…
Reference in New Issue