From a76390813a7bcd17313c99ddf2ec0f93d6e0000a Mon Sep 17 00:00:00 2001 From: John Dennis Date: Mon, 25 Jun 2018 18:04:18 -0400 Subject: [PATCH] Downcase UTF-8 file encoding name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- bindings/python/tests/XmlTestRunner.py | 2 +- bindings/python/tests/binding_tests.py | 2 +- bindings/python/tests/idwsf1_tests.py | 2 +- bindings/python/tests/idwsf2_tests.py | 2 +- bindings/python/tests/profiles_tests.py | 2 +- bindings/python/tests/tests.py | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bindings/python/tests/XmlTestRunner.py b/bindings/python/tests/XmlTestRunner.py index cb1486cf..ce92c4e8 100644 --- a/bindings/python/tests/XmlTestRunner.py +++ b/bindings/python/tests/XmlTestRunner.py @@ -1,4 +1,4 @@ -# -*- coding: UTF-8 -*- +# -*- coding: utf-8 -*- # # $Id: XmlTestRunner.py 3254 2007-06-05 21:23:57Z fpeters $ # diff --git a/bindings/python/tests/binding_tests.py b/bindings/python/tests/binding_tests.py index 54c3635f..90df3adf 100755 --- a/bindings/python/tests/binding_tests.py +++ b/bindings/python/tests/binding_tests.py @@ -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 $ # diff --git a/bindings/python/tests/idwsf1_tests.py b/bindings/python/tests/idwsf1_tests.py index 89832b9b..da8368ca 100755 --- a/bindings/python/tests/idwsf1_tests.py +++ b/bindings/python/tests/idwsf1_tests.py @@ -1,5 +1,5 @@ #! /usr/bin/env python -# -*- coding: UTF-8 -*- +# -*- coding: utf-8 -*- # # Python unit tests for Lasso library # diff --git a/bindings/python/tests/idwsf2_tests.py b/bindings/python/tests/idwsf2_tests.py index 4e47a4a1..60b114ba 100755 --- a/bindings/python/tests/idwsf2_tests.py +++ b/bindings/python/tests/idwsf2_tests.py @@ -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 $ # diff --git a/bindings/python/tests/profiles_tests.py b/bindings/python/tests/profiles_tests.py index 0ba1e56e..6ec61207 100755 --- a/bindings/python/tests/profiles_tests.py +++ b/bindings/python/tests/profiles_tests.py @@ -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 $ # diff --git a/bindings/python/tests/tests.py b/bindings/python/tests/tests.py index 4a66b7fb..a0fa6d34 100755 --- a/bindings/python/tests/tests.py +++ b/bindings/python/tests/tests.py @@ -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 $ #