diff --git a/README.rst b/README.rst
index 5b8360c08706ab808840152b2e1829f8ee0079c2..ba41577fef86bc931222bf7b8687628d8934837c 100644
--- a/README.rst
+++ b/README.rst
@@ -141,6 +141,18 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 Change history
 --------------
 
+Version 2.29.16 (06/21/2018)
+
+- Added dependencies to ``setup.py``.  Thanks to Laszlo for this
+  suggestion.
+- Fixes to specifying character encodings.  We now read XML schema
+  files in binary mode.  (2) We now use the value of
+  --external-encoding only when a generated module is run under
+  Python 2 (not Python 3); we use it to encode the XML instance
+  document; if --external-encoding was not used, then we use
+  "utf-8" to encode exported XML.  Thanks to Laszlo for his
+  guidance on this.
+
 Version 2.29.15 (05/16/2018)
 
 - Fixed issue related to use of command line flag
diff --git a/generateDS.html b/generateDS.html
index a2c4dae17d641926f2285b42a31ab64b0dbe6f77..1882d3a58b2044e4324790a8d3d0f5dd73b3a13b 100644
--- a/generateDS.html
+++ b/generateDS.html
@@ -220,7 +220,7 @@ They are used by updateversion.py. -->
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
-<tr class="field"><th class="field-name">revision:</th><td class="field-body">2.29.15</td>
+<tr class="field"><th class="field-name">revision:</th><td class="field-body">2.29.16</td>
 </tr>
 </tbody>
 </table>
@@ -229,7 +229,7 @@ They are used by updateversion.py. -->
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
-<tr class="field"><th class="field-name">date:</th><td class="field-body">May 16, 2018</td>
+<tr class="field"><th class="field-name">date:</th><td class="field-body">June 22, 2018</td>
 </tr>
 </tbody>
 </table>
@@ -3386,7 +3386,7 @@ following among others:</p>
 <div class="footer">
 <hr class="footer" />
 <a class="reference external" href="generateDS.txt">View document source</a>.
-Generated on: 2018-05-16 18:03 UTC.
+Generated on: 2018-06-22 18:15 UTC.
 Generated by <a class="reference external" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference external" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
 
 </div>
diff --git a/generateDS.py b/generateDS.py
index f8a7ffec2be920832e08f36a0545d9e422988f78..91b641f16e0c435f91f18185318f40cbc7b6e038 100755
--- a/generateDS.py
+++ b/generateDS.py
@@ -225,7 +225,7 @@ _log = logging.getLogger(__name__)
 # Do not modify the following VERSION comments.
 # Used by updateversion.py.
 ##VERSION##
-VERSION = '2.29.15'
+VERSION = '2.29.16'
 ##VERSION##
 
 BaseStrTypes = six.string_types
@@ -252,7 +252,7 @@ NoDates = False
 NoVersion = False
 AlwaysExportDefault = False
 Dirpath = []
-ExternalEncoding = sys.getdefaultencoding()
+ExternalEncoding = ''
 Namespacedef = ''
 NoNameSpaceDefs = False
 CleanupNameList = [(re.compile('[-:.]'), '_')]
@@ -5727,7 +5727,11 @@ class GeneratedsSuper(object):
     @staticmethod
     def gds_encode(instring):
         if sys.version_info.major == 2:
-            return instring.encode(ExternalEncoding)
+            if ExternalEncoding:
+                encoding = ExternalEncoding
+            else:
+                encoding = 'utf-8'
+            return instring.encode(encoding)
         else:
             return instring
     @staticmethod
@@ -6908,7 +6912,7 @@ def parseAndGenerate(
     if xschemaFileName == '-':
         infile = sys.stdin
     else:
-        infile = open(xschemaFileName, 'r')
+        infile = open(xschemaFileName, 'rb')
     if SingleFileOutput:
         parser = make_parser()
         dh = XschemaHandler()
@@ -7226,7 +7230,7 @@ def main():
     processIncludes = 1
     namespacedef = ''
     NoNameSpaceDefs = False
-    ExternalEncoding = sys.getdefaultencoding()
+    ExternalEncoding = ''
     NoDates = False
     NoVersion = False
     NoQuestions = False
diff --git a/generateDS.txt b/generateDS.txt
index 6805091e9b771a2c654c8f3ff96a5bdf2de1766b..f659bb3d96999c572d556ea6c1a1fe20d7075cba 100644
--- a/generateDS.txt
+++ b/generateDS.txt
@@ -12,7 +12,7 @@ generateDS -- Generate Data Structures from XML Schema
 
 .. version
 
-:revision: 2.29.15
+:revision: 2.29.16
 
 .. version
 
diff --git a/generateds_gui_notes.html b/generateds_gui_notes.html
index 149dc6e1be984d33821aea870c4700b91ed9fd00..96e274a3dd05b4c56a1ca6d1911e8c25e8b40f44 100644
--- a/generateds_gui_notes.html
+++ b/generateds_gui_notes.html
@@ -220,7 +220,7 @@ They are used by updateversion.py. -->
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
-<tr class="field"><th class="field-name">revision:</th><td class="field-body">2.29.15</td>
+<tr class="field"><th class="field-name">revision:</th><td class="field-body">2.29.16</td>
 </tr>
 </tbody>
 </table>
@@ -229,7 +229,7 @@ They are used by updateversion.py. -->
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
-<tr class="field"><th class="field-name">date:</th><td class="field-body">May 16, 2018</td>
+<tr class="field"><th class="field-name">date:</th><td class="field-body">June 22, 2018</td>
 </tr>
 </tbody>
 </table>
@@ -401,7 +401,7 @@ $ mv generateds_gui.mo locale/ru/LC_MESSAGES/
 <div class="footer">
 <hr class="footer" />
 <a class="reference external" href="generateds_gui_notes.txt">View document source</a>.
-Generated on: 2018-05-16 18:03 UTC.
+Generated on: 2018-06-22 18:15 UTC.
 Generated by <a class="reference external" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference external" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
 
 </div>
diff --git a/generateds_gui_notes.txt b/generateds_gui_notes.txt
index 388a7dd49e3c032606598bd35f0ebb50412e8320..50b66cf2a728d446752bb23d61da82b2928604ef 100644
--- a/generateds_gui_notes.txt
+++ b/generateds_gui_notes.txt
@@ -12,7 +12,7 @@ GenerateDS GUI Notes
 
 .. version
 
-:revision: 2.29.15
+:revision: 2.29.16
 
 .. version
 
diff --git a/gui/generateds_gui.py b/gui/generateds_gui.py
index 07e3d491d1dfcd132cc3be803db270ad0e83051c..abc17f035c43f993018cde5c3a96d574a9afb501 100644
--- a/gui/generateds_gui.py
+++ b/gui/generateds_gui.py
@@ -41,7 +41,7 @@ from libgenerateDS.gui import generateds_gui_session
 # Do not modify the following VERSION comments.
 # Used by updateversion.py.
 ##VERSION##
-VERSION = '2.29.15'
+VERSION = '2.29.16'
 ##VERSION##
 
 
diff --git a/libgenerateDS/__init__.py b/libgenerateDS/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/libgenerateDS/gui/__init__.py b/libgenerateDS/gui/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/librarytemplate_howto.html b/librarytemplate_howto.html
index a3dedbf2bc57f2dffb6f3de057a147aac5522f13..3574a0b3f1d89bdb1958b67d59382860d176ba6c 100644
--- a/librarytemplate_howto.html
+++ b/librarytemplate_howto.html
@@ -217,7 +217,7 @@ dkuhlman (at) davekuhlman (dot) org
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
-<tr class="field"><th class="field-name">revision:</th><td class="field-body">2.29.15</td>
+<tr class="field"><th class="field-name">revision:</th><td class="field-body">2.29.16</td>
 </tr>
 </tbody>
 </table>
@@ -226,7 +226,7 @@ dkuhlman (at) davekuhlman (dot) org
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
-<tr class="field"><th class="field-name">date:</th><td class="field-body">May 16, 2018</td>
+<tr class="field"><th class="field-name">date:</th><td class="field-body">June 22, 2018</td>
 </tr>
 </tbody>
 </table>
@@ -380,7 +380,7 @@ this command for your needs.  For example, you may need to use
 <div class="footer">
 <hr class="footer" />
 <a class="reference external" href="librarytemplate_howto.txt">View document source</a>.
-Generated on: 2018-05-16 18:03 UTC.
+Generated on: 2018-06-22 18:15 UTC.
 Generated by <a class="reference external" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference external" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
 
 </div>
diff --git a/librarytemplate_howto.txt b/librarytemplate_howto.txt
index d1597ee54a0f0335d2a17fa94f81a33dc17405f1..355beb18a66cc7d60bc03e48be7d74a00f7958c9 100644
--- a/librarytemplate_howto.txt
+++ b/librarytemplate_howto.txt
@@ -8,7 +8,7 @@ How to package a generateDS.py generated library
 
 .. version
 
-:revision: 2.29.15
+:revision: 2.29.16
 
 .. version
 
diff --git a/process_includes.py b/process_includes.py
index ca4a385d4a863842c93c19f3ba95344198218753..a8474491c813011fa9ea2aecbc78f2bceaac00f2 100755
--- a/process_includes.py
+++ b/process_includes.py
@@ -40,7 +40,7 @@ except ImportError:
 # Do not modify the following VERSION comments.
 # Used by updateversion.py.
 ##VERSION##
-VERSION = '2.29.15'
+VERSION = '2.29.16'
 ##VERSION##
 
 CatalogDict = {}
@@ -63,7 +63,7 @@ def load_catalog(catalogpath):
     global CatalogBaseUrl
     if catalogpath:
         CatalogBaseUrl = os.path.split(catalogpath)[0]
-        catalog = etree.parse(open(catalogpath))
+        catalog = etree.parse(open(catalogpath, "rb"))
         for elements in catalog.getroot().findall(
                 "{urn:oasis:names:tc:entity:xmlns:xml:catalog}public"):
             CatalogDict[elements.get("publicId")] = elements.get("uri")
@@ -95,6 +95,7 @@ def get_all_root_file_paths(
         catalogpath=None,
         shallow=False):
     load_catalog(catalogpath)
+    # Note: infile has been opened in binary mode.
     doc1 = etree.parse(infile)
     root1 = doc1.getroot()
     rootPaths = []
@@ -319,6 +320,7 @@ def make_file(outFileName, options):
 
 
 def prep_schema_doc(infile, outfile, inpath, options):
+    # Note: infile has been opened in binary mode.
     doc1 = etree.parse(infile)
     root1 = doc1.getroot()
     params = Params()
@@ -348,7 +350,7 @@ def prep_schema_doc(infile, outfile, inpath, options):
 
 def prep_schema(inpath, outpath, options):
     if inpath:
-        infile = open(inpath, 'r')
+        infile = open(inpath, 'rb')
     else:
         infile = sys.stdin
     if outpath:
diff --git a/setup.py b/setup.py
index 1bc9a3b385ce90a8c577c66a7a908eff695be8b9..7eeda2d6b8cea84e09af9310f740e9b8368b6806 100644
--- a/setup.py
+++ b/setup.py
@@ -2,12 +2,13 @@
 #from distutils.core import setup
 from setuptools import setup
 
-setup(name="generateDS",
+setup(
+    name="generateDS",
 #
 # Do not modify the following VERSION comments.
 # Used by updateversion.py.
 ##VERSION##
-    version="2.29.15",
+    version="2.29.16",
 ##VERSION##
     author="Dave Kuhlman",
     author_email="dkuhlman@davekuhlman.org",
@@ -26,20 +27,14 @@ methods to the subclasses in order to process the contents of an
 XML document.""",
     platforms="platform-independent",
     license="http://www.opensource.org/licenses/mit-license.php",
-##     py_modules=[
-##         "generateDS",
-##         "process_includes", 
-##         "gui.generateds_gui",
-##         "gui.generateds_gui_session",
-##         ],
     py_modules=[
         "process_includes",
-        ],
+    ],
     # include_package_data=True,
-    packages = [
+    packages=[
         "libgenerateDS",
         "libgenerateDS.gui",
-        ],
+    ],
     scripts=[
         "generateDS.py",
         "process_includes.py",
@@ -47,8 +42,8 @@ XML document.""",
         "django/gends_run_gen_django.py",
         "django/gends_extract_simple_types.py",
         "django/gends_generate_django.py",
-        ],
-    entry_points = {
+    ],
+    entry_points={
         "console_scripts": [
             "generateDS = generateDS:main",
             "process_includes = process_includes:main",
@@ -57,6 +52,9 @@ XML document.""",
             "gends_extract_simple_types = gends_extract_simple_types:main",
             "gends_generate_django = gends_generate_django:main",
         ],
-      }
-    )
-
+    },
+    install_requires=[
+        "six",
+        "lxml",
+    ],
+)
diff --git a/tests/OnePer/oneperType00_2One.py b/tests/OnePer/oneperType00_2One.py
index 1ffccc37012a5bc7491676ebb9a1f943ee9e6cb8..43976fa1ec51544ba6df203ec2a6ec6ba59bf7e9 100644
--- a/tests/OnePer/oneperType00_2One.py
+++ b/tests/OnePer/oneperType00_2One.py
@@ -406,7 +406,11 @@ except ImportError as exp:
         @staticmethod
         def gds_encode(instring):
             if sys.version_info.major == 2:
-                return instring.encode(ExternalEncoding)
+                if ExternalEncoding:
+                    encoding = ExternalEncoding
+                else:
+                    encoding = 'utf-8'
+                return instring.encode(encoding)
             else:
                 return instring
         @staticmethod
@@ -453,7 +457,7 @@ except ImportError as exp:
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 Tag_pattern_ = re_.compile(r'({.*})?(.*)')
 String_cleanup_pat_ = re_.compile(r"[\n\r\s]+")
 Namespace_extract_pat_ = re_.compile(r'{(.*)}(.*)')
diff --git a/tests/OnePer/oneperType01_2One.py b/tests/OnePer/oneperType01_2One.py
index f5a426785df579d9b21a8677b13f55f27e3a5ca5..829c9f2b4aebd3e56d9433b574623004b69e86a0 100644
--- a/tests/OnePer/oneperType01_2One.py
+++ b/tests/OnePer/oneperType01_2One.py
@@ -406,7 +406,11 @@ except ImportError as exp:
         @staticmethod
         def gds_encode(instring):
             if sys.version_info.major == 2:
-                return instring.encode(ExternalEncoding)
+                if ExternalEncoding:
+                    encoding = ExternalEncoding
+                else:
+                    encoding = 'utf-8'
+                return instring.encode(encoding)
             else:
                 return instring
         @staticmethod
@@ -453,7 +457,7 @@ except ImportError as exp:
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 Tag_pattern_ = re_.compile(r'({.*})?(.*)')
 String_cleanup_pat_ = re_.compile(r"[\n\r\s]+")
 Namespace_extract_pat_ = re_.compile(r'{(.*)}(.*)')
diff --git a/tests/OnePer/oneperType02_2One.py b/tests/OnePer/oneperType02_2One.py
index 6c37be00d342bb1760475e2a43f908f6b79dc0db..7dc51eccc9c78e04e06faee3547e96375200c52c 100644
--- a/tests/OnePer/oneperType02_2One.py
+++ b/tests/OnePer/oneperType02_2One.py
@@ -406,7 +406,11 @@ except ImportError as exp:
         @staticmethod
         def gds_encode(instring):
             if sys.version_info.major == 2:
-                return instring.encode(ExternalEncoding)
+                if ExternalEncoding:
+                    encoding = ExternalEncoding
+                else:
+                    encoding = 'utf-8'
+                return instring.encode(encoding)
             else:
                 return instring
         @staticmethod
@@ -453,7 +457,7 @@ except ImportError as exp:
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 Tag_pattern_ = re_.compile(r'({.*})?(.*)')
 String_cleanup_pat_ = re_.compile(r"[\n\r\s]+")
 Namespace_extract_pat_ = re_.compile(r'{(.*)}(.*)')
diff --git a/tests/OnePer/oneperType03_2One.py b/tests/OnePer/oneperType03_2One.py
index 5b825bedc4e8a640b7f0b578918dc19bb8840eca..c473e8e8c94f55c0556184893d20536afae22a96 100644
--- a/tests/OnePer/oneperType03_2One.py
+++ b/tests/OnePer/oneperType03_2One.py
@@ -406,7 +406,11 @@ except ImportError as exp:
         @staticmethod
         def gds_encode(instring):
             if sys.version_info.major == 2:
-                return instring.encode(ExternalEncoding)
+                if ExternalEncoding:
+                    encoding = ExternalEncoding
+                else:
+                    encoding = 'utf-8'
+                return instring.encode(encoding)
             else:
                 return instring
         @staticmethod
@@ -453,7 +457,7 @@ except ImportError as exp:
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 Tag_pattern_ = re_.compile(r'({.*})?(.*)')
 String_cleanup_pat_ = re_.compile(r"[\n\r\s]+")
 Namespace_extract_pat_ = re_.compile(r'{(.*)}(.*)')
diff --git a/tests/abstract_type1_sub.py b/tests/abstract_type1_sub.py
index 51ec544b14b1f8f3e472efcfef0d5abcdc6bb2e3..3e9f9ad6a1b359ec3bfbfe7cc9736709022b33ff 100644
--- a/tests/abstract_type1_sub.py
+++ b/tests/abstract_type1_sub.py
@@ -41,7 +41,7 @@ def parsexml_(infile, parser=None, **kwargs):
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 
 #
 # Data representation classes
diff --git a/tests/abstract_type1_sup.py b/tests/abstract_type1_sup.py
index 8f617deb6e71d0637aeb0c3bfdc6450c06d0770b..d609a67b4974f544acd8957702dc1c612daf93a2 100644
--- a/tests/abstract_type1_sup.py
+++ b/tests/abstract_type1_sup.py
@@ -405,7 +405,11 @@ except ImportError as exp:
         @staticmethod
         def gds_encode(instring):
             if sys.version_info.major == 2:
-                return instring.encode(ExternalEncoding)
+                if ExternalEncoding:
+                    encoding = ExternalEncoding
+                else:
+                    encoding = 'utf-8'
+                return instring.encode(encoding)
             else:
                 return instring
         @staticmethod
@@ -452,7 +456,7 @@ except ImportError as exp:
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 Tag_pattern_ = re_.compile(r'({.*})?(.*)')
 String_cleanup_pat_ = re_.compile(r"[\n\r\s]+")
 Namespace_extract_pat_ = re_.compile(r'{(.*)}(.*)')
diff --git a/tests/annotations1_sub.py b/tests/annotations1_sub.py
index fc1467f25b4c611c8682febc4572a508bd4867d5..ddf61bbac2ec13b82261f331e6029fe1f5a21148 100644
--- a/tests/annotations1_sub.py
+++ b/tests/annotations1_sub.py
@@ -41,7 +41,7 @@ def parsexml_(infile, parser=None, **kwargs):
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 
 #
 # Data representation classes
diff --git a/tests/annotations1_sup.py b/tests/annotations1_sup.py
index 306fae8476f21d08dafaa9866d84d2a171121478..36a3bae6a9e84341c29b38faf58648b4847baf77 100644
--- a/tests/annotations1_sup.py
+++ b/tests/annotations1_sup.py
@@ -405,7 +405,11 @@ except ImportError as exp:
         @staticmethod
         def gds_encode(instring):
             if sys.version_info.major == 2:
-                return instring.encode(ExternalEncoding)
+                if ExternalEncoding:
+                    encoding = ExternalEncoding
+                else:
+                    encoding = 'utf-8'
+                return instring.encode(encoding)
             else:
                 return instring
         @staticmethod
@@ -452,7 +456,7 @@ except ImportError as exp:
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 Tag_pattern_ = re_.compile(r'({.*})?(.*)')
 String_cleanup_pat_ = re_.compile(r"[\n\r\s]+")
 Namespace_extract_pat_ = re_.compile(r'{(.*)}(.*)')
diff --git a/tests/anonymous_type1_sub.py b/tests/anonymous_type1_sub.py
index cc15886f3d8fc3dd97acfd7bf709d85bda59870e..7ef6f4c615c59ffe6e3f1270a4f30532f0302d35 100644
--- a/tests/anonymous_type1_sub.py
+++ b/tests/anonymous_type1_sub.py
@@ -41,7 +41,7 @@ def parsexml_(infile, parser=None, **kwargs):
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 
 #
 # Data representation classes
diff --git a/tests/anonymous_type1_sup.py b/tests/anonymous_type1_sup.py
index 80237f134a4e23c22f397699ea442a65708bec58..72419ecb420b5f6dd625a584f6ef9104b947b80d 100644
--- a/tests/anonymous_type1_sup.py
+++ b/tests/anonymous_type1_sup.py
@@ -405,7 +405,11 @@ except ImportError as exp:
         @staticmethod
         def gds_encode(instring):
             if sys.version_info.major == 2:
-                return instring.encode(ExternalEncoding)
+                if ExternalEncoding:
+                    encoding = ExternalEncoding
+                else:
+                    encoding = 'utf-8'
+                return instring.encode(encoding)
             else:
                 return instring
         @staticmethod
@@ -452,7 +456,7 @@ except ImportError as exp:
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 Tag_pattern_ = re_.compile(r'({.*})?(.*)')
 String_cleanup_pat_ = re_.compile(r"[\n\r\s]+")
 Namespace_extract_pat_ = re_.compile(r'{(.*)}(.*)')
diff --git a/tests/anysimpletype1_sub.py b/tests/anysimpletype1_sub.py
index 2f6bcb37bc2d9fa83d36ceee1ca2406b7fec2b84..48694db3a086df8f2267e5044bd3e7805bc1180d 100644
--- a/tests/anysimpletype1_sub.py
+++ b/tests/anysimpletype1_sub.py
@@ -41,7 +41,7 @@ def parsexml_(infile, parser=None, **kwargs):
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 
 #
 # Data representation classes
diff --git a/tests/anysimpletype1_sup.py b/tests/anysimpletype1_sup.py
index e3f355a74447484bf801731ab14a327719841ce8..8851b661644ab3cfe21a7b8578f2d39c889c64f9 100644
--- a/tests/anysimpletype1_sup.py
+++ b/tests/anysimpletype1_sup.py
@@ -405,7 +405,11 @@ except ImportError as exp:
         @staticmethod
         def gds_encode(instring):
             if sys.version_info.major == 2:
-                return instring.encode(ExternalEncoding)
+                if ExternalEncoding:
+                    encoding = ExternalEncoding
+                else:
+                    encoding = 'utf-8'
+                return instring.encode(encoding)
             else:
                 return instring
         @staticmethod
@@ -452,7 +456,7 @@ except ImportError as exp:
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 Tag_pattern_ = re_.compile(r'({.*})?(.*)')
 String_cleanup_pat_ = re_.compile(r"[\n\r\s]+")
 Namespace_extract_pat_ = re_.compile(r'{(.*)}(.*)')
diff --git a/tests/anywildcard1_sub.py b/tests/anywildcard1_sub.py
index 84897dd49ea0ab380bd0b1ee47c932ea3aa1a25f..7923b4782dabe46b78d9b58cc78efb51a61e1dcf 100644
--- a/tests/anywildcard1_sub.py
+++ b/tests/anywildcard1_sub.py
@@ -41,7 +41,7 @@ def parsexml_(infile, parser=None, **kwargs):
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 
 #
 # Data representation classes
diff --git a/tests/anywildcard1_sup.py b/tests/anywildcard1_sup.py
index 22dac15ddab75ec97afecdb54c680756aac43d47..b51c6dfd83aa58a7982e1cbae0979577884e5cce 100644
--- a/tests/anywildcard1_sup.py
+++ b/tests/anywildcard1_sup.py
@@ -405,7 +405,11 @@ except ImportError as exp:
         @staticmethod
         def gds_encode(instring):
             if sys.version_info.major == 2:
-                return instring.encode(ExternalEncoding)
+                if ExternalEncoding:
+                    encoding = ExternalEncoding
+                else:
+                    encoding = 'utf-8'
+                return instring.encode(encoding)
             else:
                 return instring
         @staticmethod
@@ -452,7 +456,7 @@ except ImportError as exp:
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 Tag_pattern_ = re_.compile(r'({.*})?(.*)')
 String_cleanup_pat_ = re_.compile(r"[\n\r\s]+")
 Namespace_extract_pat_ = re_.compile(r'{(.*)}(.*)')
diff --git a/tests/attr_groups1_sub.py b/tests/attr_groups1_sub.py
index b5627f9b9e48b947b6e00a2434855cd599353827..73a0d3dad2cd875ccb3df3a32d3fab9376168ed1 100644
--- a/tests/attr_groups1_sub.py
+++ b/tests/attr_groups1_sub.py
@@ -41,7 +41,7 @@ def parsexml_(infile, parser=None, **kwargs):
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 
 #
 # Data representation classes
diff --git a/tests/attr_groups1_sup.py b/tests/attr_groups1_sup.py
index 4c34fd7e30abf7ccb00f45537b95212a362354b3..ce033d7c05d4d75d07706b8eb77af68221c654f4 100644
--- a/tests/attr_groups1_sup.py
+++ b/tests/attr_groups1_sup.py
@@ -405,7 +405,11 @@ except ImportError as exp:
         @staticmethod
         def gds_encode(instring):
             if sys.version_info.major == 2:
-                return instring.encode(ExternalEncoding)
+                if ExternalEncoding:
+                    encoding = ExternalEncoding
+                else:
+                    encoding = 'utf-8'
+                return instring.encode(encoding)
             else:
                 return instring
         @staticmethod
@@ -452,7 +456,7 @@ except ImportError as exp:
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 Tag_pattern_ = re_.compile(r'({.*})?(.*)')
 String_cleanup_pat_ = re_.compile(r"[\n\r\s]+")
 Namespace_extract_pat_ = re_.compile(r'{(.*)}(.*)')
diff --git a/tests/catalogtest1_sub.py b/tests/catalogtest1_sub.py
index 5789ad737ede7e4ec463d3a18f61e9716ef349da..b614f1161fde8ae5cc6a8ca44e8c8b47dc1c9743 100644
--- a/tests/catalogtest1_sub.py
+++ b/tests/catalogtest1_sub.py
@@ -42,7 +42,7 @@ def parsexml_(infile, parser=None, **kwargs):
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 
 #
 # Data representation classes
diff --git a/tests/catalogtest1_sup.py b/tests/catalogtest1_sup.py
index 65a9e4d9e9d15c2dc6b063da3521409a6cde6914..ab95f81716025b5261208c5024796660dd506e60 100644
--- a/tests/catalogtest1_sup.py
+++ b/tests/catalogtest1_sup.py
@@ -406,7 +406,11 @@ except ImportError as exp:
         @staticmethod
         def gds_encode(instring):
             if sys.version_info.major == 2:
-                return instring.encode(ExternalEncoding)
+                if ExternalEncoding:
+                    encoding = ExternalEncoding
+                else:
+                    encoding = 'utf-8'
+                return instring.encode(encoding)
             else:
                 return instring
         @staticmethod
@@ -453,7 +457,7 @@ except ImportError as exp:
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 Tag_pattern_ = re_.compile(r'({.*})?(.*)')
 String_cleanup_pat_ = re_.compile(r"[\n\r\s]+")
 Namespace_extract_pat_ = re_.compile(r'{(.*)}(.*)')
diff --git a/tests/cdata1_sub.py b/tests/cdata1_sub.py
index e73b9d92994301c7372049a9884504b5c00b9b1a..9e4e20a123ddc2a46856dfe6ff3d32e7883b6a82 100644
--- a/tests/cdata1_sub.py
+++ b/tests/cdata1_sub.py
@@ -42,7 +42,7 @@ def parsexml_(infile, parser=None, **kwargs):
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 
 #
 # Data representation classes
diff --git a/tests/cdata1_sup.py b/tests/cdata1_sup.py
index 147ebb03491126598754772eceb6ced989983b9c..599a90d6e076fd554c23b33d3bc6ed8e40e7b518 100644
--- a/tests/cdata1_sup.py
+++ b/tests/cdata1_sup.py
@@ -406,7 +406,11 @@ except ImportError as exp:
         @staticmethod
         def gds_encode(instring):
             if sys.version_info.major == 2:
-                return instring.encode(ExternalEncoding)
+                if ExternalEncoding:
+                    encoding = ExternalEncoding
+                else:
+                    encoding = 'utf-8'
+                return instring.encode(encoding)
             else:
                 return instring
         @staticmethod
@@ -453,7 +457,7 @@ except ImportError as exp:
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 Tag_pattern_ = re_.compile(r'({.*})?(.*)')
 String_cleanup_pat_ = re_.compile(r"[\n\r\s]+")
 Namespace_extract_pat_ = re_.compile(r'{(.*)}(.*)')
diff --git a/tests/cleanupname1_sub.py b/tests/cleanupname1_sub.py
index 0bdd0ef8f4367af95a0622b51acd06cb62ae1eea..e9e592a02683a7624142cdfc4e1d0d9a38f65dcc 100644
--- a/tests/cleanupname1_sub.py
+++ b/tests/cleanupname1_sub.py
@@ -42,7 +42,7 @@ def parsexml_(infile, parser=None, **kwargs):
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 
 #
 # Data representation classes
diff --git a/tests/cleanupname1_sup.py b/tests/cleanupname1_sup.py
index 0c1f1fce554b6a964ebcfa09fed9a18c7277b874..76ae5384c7be271e12d36ab8a6718f3d61195de9 100644
--- a/tests/cleanupname1_sup.py
+++ b/tests/cleanupname1_sup.py
@@ -406,7 +406,11 @@ except ImportError as exp:
         @staticmethod
         def gds_encode(instring):
             if sys.version_info.major == 2:
-                return instring.encode(ExternalEncoding)
+                if ExternalEncoding:
+                    encoding = ExternalEncoding
+                else:
+                    encoding = 'utf-8'
+                return instring.encode(encoding)
             else:
                 return instring
         @staticmethod
@@ -453,7 +457,7 @@ except ImportError as exp:
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 Tag_pattern_ = re_.compile(r'({.*})?(.*)')
 String_cleanup_pat_ = re_.compile(r"[\n\r\s]+")
 Namespace_extract_pat_ = re_.compile(r'{(.*)}(.*)')
diff --git a/tests/copy_all b/tests/copy_all
index 87ffae9b2e519691494b406141c39add94491087..06d9909223c7eeb6bf06c3ea04d7d5e2704d667d 100755
--- a/tests/copy_all
+++ b/tests/copy_all
@@ -61,5 +61,9 @@ cp disable_xml_super2_sup.py disable_xml_super1_sup.py
 cp disable_xml_super2_sub.py disable_xml_super1_sub.py
 #cp defaults_cases_export2_sub.py defaults_cases_export1_sub.py
 #cp defaults_cases_export2_sup.py defaults_cases_export1_sup.py
+cp defaults_cases_always2_sub.py defaults_cases_always1_sub.py
+cp defaults_cases_always2_sup.py defaults_cases_always1_sup.py
 cp mixedcontent2_sub.py mixedcontent1_sub.py
 cp mixedcontent2_sup.py mixedcontent1_sup.py
+cp no_namespace_defs2_sub.py no_namespace_defs1_sub.py
+cp no_namespace_defs2_sup.py no_namespace_defs1_sup.py
diff --git a/tests/defaults_cases1_sub.py b/tests/defaults_cases1_sub.py
index 32171bb9111163d20ddbcf07302be9315a10436f..e61d2b0b6b465524b72082efa23b7a3319704dfd 100644
--- a/tests/defaults_cases1_sub.py
+++ b/tests/defaults_cases1_sub.py
@@ -40,7 +40,7 @@ def parsexml_(infile, parser=None, **kwargs):
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 
 #
 # Data representation classes
diff --git a/tests/defaults_cases1_sup.py b/tests/defaults_cases1_sup.py
index 78baf41f2d572ebe23939af20dcfb0c4ab14f534..110973ee05075b34c2c6e26796a49367bb1a6bce 100644
--- a/tests/defaults_cases1_sup.py
+++ b/tests/defaults_cases1_sup.py
@@ -404,7 +404,11 @@ except ImportError as exp:
         @staticmethod
         def gds_encode(instring):
             if sys.version_info.major == 2:
-                return instring.encode(ExternalEncoding)
+                if ExternalEncoding:
+                    encoding = ExternalEncoding
+                else:
+                    encoding = 'utf-8'
+                return instring.encode(encoding)
             else:
                 return instring
         @staticmethod
@@ -451,7 +455,7 @@ except ImportError as exp:
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 Tag_pattern_ = re_.compile(r'({.*})?(.*)')
 String_cleanup_pat_ = re_.compile(r"[\n\r\s]+")
 Namespace_extract_pat_ = re_.compile(r'{(.*)}(.*)')
diff --git a/tests/defaults_cases_always1_sub.py b/tests/defaults_cases_always1_sub.py
index 1cfaa417f255f498c811a17b9b586a191e9b7486..8bf354532d02eab0b2569036954f3a8bd4f478af 100644
--- a/tests/defaults_cases_always1_sub.py
+++ b/tests/defaults_cases_always1_sub.py
@@ -41,7 +41,7 @@ def parsexml_(infile, parser=None, **kwargs):
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 
 #
 # Data representation classes
diff --git a/tests/defaults_cases_always1_sup.py b/tests/defaults_cases_always1_sup.py
index 343317577db9debf800f532286d34c370960ce96..81e1e8f943f26097df5b5e5e9a6f643338a2d483 100644
--- a/tests/defaults_cases_always1_sup.py
+++ b/tests/defaults_cases_always1_sup.py
@@ -405,7 +405,11 @@ except ImportError as exp:
         @staticmethod
         def gds_encode(instring):
             if sys.version_info.major == 2:
-                return instring.encode(ExternalEncoding)
+                if ExternalEncoding:
+                    encoding = ExternalEncoding
+                else:
+                    encoding = 'utf-8'
+                return instring.encode(encoding)
             else:
                 return instring
         @staticmethod
@@ -452,7 +456,7 @@ except ImportError as exp:
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 Tag_pattern_ = re_.compile(r'({.*})?(.*)')
 String_cleanup_pat_ = re_.compile(r"[\n\r\s]+")
 Namespace_extract_pat_ = re_.compile(r'{(.*)}(.*)')
diff --git a/tests/defaults_cases_always2_sub.py b/tests/defaults_cases_always2_sub.py
index 1cfaa417f255f498c811a17b9b586a191e9b7486..8bf354532d02eab0b2569036954f3a8bd4f478af 100644
--- a/tests/defaults_cases_always2_sub.py
+++ b/tests/defaults_cases_always2_sub.py
@@ -41,7 +41,7 @@ def parsexml_(infile, parser=None, **kwargs):
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 
 #
 # Data representation classes
diff --git a/tests/defaults_cases_always2_sup.py b/tests/defaults_cases_always2_sup.py
index 343317577db9debf800f532286d34c370960ce96..81e1e8f943f26097df5b5e5e9a6f643338a2d483 100644
--- a/tests/defaults_cases_always2_sup.py
+++ b/tests/defaults_cases_always2_sup.py
@@ -405,7 +405,11 @@ except ImportError as exp:
         @staticmethod
         def gds_encode(instring):
             if sys.version_info.major == 2:
-                return instring.encode(ExternalEncoding)
+                if ExternalEncoding:
+                    encoding = ExternalEncoding
+                else:
+                    encoding = 'utf-8'
+                return instring.encode(encoding)
             else:
                 return instring
         @staticmethod
@@ -452,7 +456,7 @@ except ImportError as exp:
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 Tag_pattern_ = re_.compile(r'({.*})?(.*)')
 String_cleanup_pat_ = re_.compile(r"[\n\r\s]+")
 Namespace_extract_pat_ = re_.compile(r'{(.*)}(.*)')
diff --git a/tests/defaults_coverage1_sub.py b/tests/defaults_coverage1_sub.py
index 63093d947a753d5e3b39777da305dad52b490c5a..ad86b2495fa984ec81c096dec32c486d0d5cd7a3 100644
--- a/tests/defaults_coverage1_sub.py
+++ b/tests/defaults_coverage1_sub.py
@@ -41,7 +41,7 @@ def parsexml_(infile, parser=None, **kwargs):
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 
 #
 # Data representation classes
diff --git a/tests/defaults_coverage1_sup.py b/tests/defaults_coverage1_sup.py
index 0979dee14e6c3e89f7bdc2744062c93a67b7130a..df0172a1d321ffcffe9be9b6961d4afd557727bf 100644
--- a/tests/defaults_coverage1_sup.py
+++ b/tests/defaults_coverage1_sup.py
@@ -405,7 +405,11 @@ except ImportError as exp:
         @staticmethod
         def gds_encode(instring):
             if sys.version_info.major == 2:
-                return instring.encode(ExternalEncoding)
+                if ExternalEncoding:
+                    encoding = ExternalEncoding
+                else:
+                    encoding = 'utf-8'
+                return instring.encode(encoding)
             else:
                 return instring
         @staticmethod
@@ -452,7 +456,7 @@ except ImportError as exp:
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 Tag_pattern_ = re_.compile(r'({.*})?(.*)')
 String_cleanup_pat_ = re_.compile(r"[\n\r\s]+")
 Namespace_extract_pat_ = re_.compile(r'{(.*)}(.*)')
diff --git a/tests/disable_xml_super1_sub.py b/tests/disable_xml_super1_sub.py
index 21e7bdb455f0417a4eb4ec01c7337bf5146f1bbc..834db927a5432695e6060edb324751f7379b0826 100644
--- a/tests/disable_xml_super1_sub.py
+++ b/tests/disable_xml_super1_sub.py
@@ -44,7 +44,7 @@ import disable_xml_super2_sup as supermod
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 
 #
 # Data representation classes
diff --git a/tests/disable_xml_super1_sup.py b/tests/disable_xml_super1_sup.py
index fd6688ad86a9094e2dbe6840d4bff96d09382415..7da757e3ccf4c3a820852d2876936e851e98bbb7 100644
--- a/tests/disable_xml_super1_sup.py
+++ b/tests/disable_xml_super1_sup.py
@@ -405,7 +405,11 @@ class GeneratedsSuper(object):
     @staticmethod
     def gds_encode(instring):
         if sys.version_info.major == 2:
-            return instring.encode(ExternalEncoding)
+            if ExternalEncoding:
+                encoding = ExternalEncoding
+            else:
+                encoding = 'utf-8'
+            return instring.encode(encoding)
         else:
             return instring
     @staticmethod
@@ -452,7 +456,7 @@ def getSubclassFromModule_(module, class_):
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 Tag_pattern_ = re_.compile(r'({.*})?(.*)')
 String_cleanup_pat_ = re_.compile(r"[\n\r\s]+")
 Namespace_extract_pat_ = re_.compile(r'{(.*)}(.*)')
diff --git a/tests/extensions1_sub.py b/tests/extensions1_sub.py
index 1d42391870309b9b11247b70fa1b9e2fe1b60c43..b941dce4ba307972a840f5405ba80ebefff13ce7 100644
--- a/tests/extensions1_sub.py
+++ b/tests/extensions1_sub.py
@@ -41,7 +41,7 @@ def parsexml_(infile, parser=None, **kwargs):
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 
 #
 # Data representation classes
diff --git a/tests/extensions1_sup.py b/tests/extensions1_sup.py
index e24e044a131b94510d10ece7942582c126216490..50cd8ab1103f90598b99dff1d2632e0938a87c56 100644
--- a/tests/extensions1_sup.py
+++ b/tests/extensions1_sup.py
@@ -405,7 +405,11 @@ except ImportError as exp:
         @staticmethod
         def gds_encode(instring):
             if sys.version_info.major == 2:
-                return instring.encode(ExternalEncoding)
+                if ExternalEncoding:
+                    encoding = ExternalEncoding
+                else:
+                    encoding = 'utf-8'
+                return instring.encode(encoding)
             else:
                 return instring
         @staticmethod
@@ -452,7 +456,7 @@ except ImportError as exp:
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 Tag_pattern_ = re_.compile(r'({.*})?(.*)')
 String_cleanup_pat_ = re_.compile(r"[\n\r\s]+")
 Namespace_extract_pat_ = re_.compile(r'{(.*)}(.*)')
diff --git a/tests/ipo1_sub.py b/tests/ipo1_sub.py
index edd498e2aa034fcdb2e943b13a5be70f65021282..d9964b3e922b496245ec163df34bbd020035d335 100644
--- a/tests/ipo1_sub.py
+++ b/tests/ipo1_sub.py
@@ -40,7 +40,7 @@ def parsexml_(infile, parser=None, **kwargs):
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 
 #
 # Data representation classes
diff --git a/tests/ipo1_sup.py b/tests/ipo1_sup.py
index a2121467d245a692f2e7c89e13c5eb33478da339..e1fe34fc24be74809fc264ac2a0fc86a4fe8b4a0 100644
--- a/tests/ipo1_sup.py
+++ b/tests/ipo1_sup.py
@@ -404,7 +404,11 @@ except ImportError as exp:
         @staticmethod
         def gds_encode(instring):
             if sys.version_info.major == 2:
-                return instring.encode(ExternalEncoding)
+                if ExternalEncoding:
+                    encoding = ExternalEncoding
+                else:
+                    encoding = 'utf-8'
+                return instring.encode(encoding)
             else:
                 return instring
         @staticmethod
@@ -451,7 +455,7 @@ except ImportError as exp:
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 Tag_pattern_ = re_.compile(r'({.*})?(.*)')
 String_cleanup_pat_ = re_.compile(r"[\n\r\s]+")
 Namespace_extract_pat_ = re_.compile(r'{(.*)}(.*)')
diff --git a/tests/ipo2_sub.py b/tests/ipo2_sub.py
index edd498e2aa034fcdb2e943b13a5be70f65021282..d9964b3e922b496245ec163df34bbd020035d335 100644
--- a/tests/ipo2_sub.py
+++ b/tests/ipo2_sub.py
@@ -40,7 +40,7 @@ def parsexml_(infile, parser=None, **kwargs):
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 
 #
 # Data representation classes
diff --git a/tests/ipo2_sup.py b/tests/ipo2_sup.py
index a2121467d245a692f2e7c89e13c5eb33478da339..e1fe34fc24be74809fc264ac2a0fc86a4fe8b4a0 100644
--- a/tests/ipo2_sup.py
+++ b/tests/ipo2_sup.py
@@ -404,7 +404,11 @@ except ImportError as exp:
         @staticmethod
         def gds_encode(instring):
             if sys.version_info.major == 2:
-                return instring.encode(ExternalEncoding)
+                if ExternalEncoding:
+                    encoding = ExternalEncoding
+                else:
+                    encoding = 'utf-8'
+                return instring.encode(encoding)
             else:
                 return instring
         @staticmethod
@@ -451,7 +455,7 @@ except ImportError as exp:
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 Tag_pattern_ = re_.compile(r'({.*})?(.*)')
 String_cleanup_pat_ = re_.compile(r"[\n\r\s]+")
 Namespace_extract_pat_ = re_.compile(r'{(.*)}(.*)')
diff --git a/tests/mapcleanname1_sub.py b/tests/mapcleanname1_sub.py
index ecdbfc4240731a5ebbcb25fd51d3f9feae6d958e..3a5ae6742fe631c6dc75afd701c5e3f3a4270ed5 100644
--- a/tests/mapcleanname1_sub.py
+++ b/tests/mapcleanname1_sub.py
@@ -41,7 +41,7 @@ def parsexml_(infile, parser=None, **kwargs):
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 
 #
 # Data representation classes
diff --git a/tests/mapcleanname1_sup.py b/tests/mapcleanname1_sup.py
index b3fe993427d385ac71ad79af4f7371a37c6f72bc..5c0918c869692c42d9d6e183f91430a87a8bdb51 100644
--- a/tests/mapcleanname1_sup.py
+++ b/tests/mapcleanname1_sup.py
@@ -405,7 +405,11 @@ except ImportError as exp:
         @staticmethod
         def gds_encode(instring):
             if sys.version_info.major == 2:
-                return instring.encode(ExternalEncoding)
+                if ExternalEncoding:
+                    encoding = ExternalEncoding
+                else:
+                    encoding = 'utf-8'
+                return instring.encode(encoding)
             else:
                 return instring
         @staticmethod
@@ -452,7 +456,7 @@ except ImportError as exp:
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 Tag_pattern_ = re_.compile(r'({.*})?(.*)')
 String_cleanup_pat_ = re_.compile(r"[\n\r\s]+")
 Namespace_extract_pat_ = re_.compile(r'{(.*)}(.*)')
diff --git a/tests/mixedcontent1_sub.py b/tests/mixedcontent1_sub.py
index 3f6d05ff954e7238080e8911b1a75319ceebabd8..abb0a2ef9926e376832ba99e8eeb90a2d7925788 100644
--- a/tests/mixedcontent1_sub.py
+++ b/tests/mixedcontent1_sub.py
@@ -40,7 +40,7 @@ def parsexml_(infile, parser=None, **kwargs):
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 
 #
 # Data representation classes
diff --git a/tests/mixedcontent1_sup.py b/tests/mixedcontent1_sup.py
index 475c35de75dcbf43c378596af41d017703873a5b..585f712c3a9cbaa84485158ec05b7f35aafe5094 100644
--- a/tests/mixedcontent1_sup.py
+++ b/tests/mixedcontent1_sup.py
@@ -404,7 +404,11 @@ except ImportError as exp:
         @staticmethod
         def gds_encode(instring):
             if sys.version_info.major == 2:
-                return instring.encode(ExternalEncoding)
+                if ExternalEncoding:
+                    encoding = ExternalEncoding
+                else:
+                    encoding = 'utf-8'
+                return instring.encode(encoding)
             else:
                 return instring
         @staticmethod
@@ -451,7 +455,7 @@ except ImportError as exp:
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 Tag_pattern_ = re_.compile(r'({.*})?(.*)')
 String_cleanup_pat_ = re_.compile(r"[\n\r\s]+")
 Namespace_extract_pat_ = re_.compile(r'{(.*)}(.*)')
diff --git a/tests/mixedcontent2_sub.py b/tests/mixedcontent2_sub.py
index 3f6d05ff954e7238080e8911b1a75319ceebabd8..abb0a2ef9926e376832ba99e8eeb90a2d7925788 100644
--- a/tests/mixedcontent2_sub.py
+++ b/tests/mixedcontent2_sub.py
@@ -40,7 +40,7 @@ def parsexml_(infile, parser=None, **kwargs):
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 
 #
 # Data representation classes
diff --git a/tests/mixedcontent2_sup.py b/tests/mixedcontent2_sup.py
index 475c35de75dcbf43c378596af41d017703873a5b..585f712c3a9cbaa84485158ec05b7f35aafe5094 100644
--- a/tests/mixedcontent2_sup.py
+++ b/tests/mixedcontent2_sup.py
@@ -404,7 +404,11 @@ except ImportError as exp:
         @staticmethod
         def gds_encode(instring):
             if sys.version_info.major == 2:
-                return instring.encode(ExternalEncoding)
+                if ExternalEncoding:
+                    encoding = ExternalEncoding
+                else:
+                    encoding = 'utf-8'
+                return instring.encode(encoding)
             else:
                 return instring
         @staticmethod
@@ -451,7 +455,7 @@ except ImportError as exp:
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 Tag_pattern_ = re_.compile(r'({.*})?(.*)')
 String_cleanup_pat_ = re_.compile(r"[\n\r\s]+")
 Namespace_extract_pat_ = re_.compile(r'{(.*)}(.*)')
diff --git a/tests/nested_def1_sub.py b/tests/nested_def1_sub.py
index ad6412afbf7f4b96dd6c9b700fa06109506b1c01..1dc5f875c07cdc51f632bac8f0e35dec6468f41e 100644
--- a/tests/nested_def1_sub.py
+++ b/tests/nested_def1_sub.py
@@ -40,7 +40,7 @@ def parsexml_(infile, parser=None, **kwargs):
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 
 #
 # Data representation classes
diff --git a/tests/nested_def1_sup.py b/tests/nested_def1_sup.py
index eea9981dc3251c05dca239dd8b7e553a28709258..1a2f5d06b1ba21bcd83c3514dbcd077bb34c7fe3 100644
--- a/tests/nested_def1_sup.py
+++ b/tests/nested_def1_sup.py
@@ -404,7 +404,11 @@ except ImportError as exp:
         @staticmethod
         def gds_encode(instring):
             if sys.version_info.major == 2:
-                return instring.encode(ExternalEncoding)
+                if ExternalEncoding:
+                    encoding = ExternalEncoding
+                else:
+                    encoding = 'utf-8'
+                return instring.encode(encoding)
             else:
                 return instring
         @staticmethod
@@ -451,7 +455,7 @@ except ImportError as exp:
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 Tag_pattern_ = re_.compile(r'({.*})?(.*)')
 String_cleanup_pat_ = re_.compile(r"[\n\r\s]+")
 Namespace_extract_pat_ = re_.compile(r'{(.*)}(.*)')
diff --git a/tests/no_namespace_defs1_sub.py b/tests/no_namespace_defs1_sub.py
index b54fcb2437d89727415e192418f763daf63868ce..58a1bce1363f681a8e08807c60f828869fdbeb16 100644
--- a/tests/no_namespace_defs1_sub.py
+++ b/tests/no_namespace_defs1_sub.py
@@ -44,7 +44,7 @@ import no_namespace_defs2_sup as supermod
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 
 #
 # Data representation classes
diff --git a/tests/no_namespace_defs1_sup.py b/tests/no_namespace_defs1_sup.py
index ca8cbc78a3702ab448dc4b6757c97e206f27b98a..fdd644dc13f6088924d9ceef17e8deb6b2dd1a70 100644
--- a/tests/no_namespace_defs1_sup.py
+++ b/tests/no_namespace_defs1_sup.py
@@ -405,7 +405,11 @@ class GeneratedsSuper(object):
     @staticmethod
     def gds_encode(instring):
         if sys.version_info.major == 2:
-            return instring.encode(ExternalEncoding)
+            if ExternalEncoding:
+                encoding = ExternalEncoding
+            else:
+                encoding = 'utf-8'
+            return instring.encode(encoding)
         else:
             return instring
     @staticmethod
@@ -452,7 +456,7 @@ def getSubclassFromModule_(module, class_):
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 Tag_pattern_ = re_.compile(r'({.*})?(.*)')
 String_cleanup_pat_ = re_.compile(r"[\n\r\s]+")
 Namespace_extract_pat_ = re_.compile(r'{(.*)}(.*)')
diff --git a/tests/out1_sub.py b/tests/out1_sub.py
index 8738817204dfbaf59d61577bae43605ce7282671..ebf1b3e080ce7a36c7acd82f69e3d1fcdfca54ad 100644
--- a/tests/out1_sub.py
+++ b/tests/out1_sub.py
@@ -41,7 +41,7 @@ def parsexml_(infile, parser=None, **kwargs):
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 
 #
 # Data representation classes
diff --git a/tests/out1_sup.py b/tests/out1_sup.py
index 898638cdc0e83f1ea4250e3445c294efba518584..26e0d900823b2812c82168ab64bbcfbbbedb76d1 100644
--- a/tests/out1_sup.py
+++ b/tests/out1_sup.py
@@ -405,7 +405,11 @@ except ImportError as exp:
         @staticmethod
         def gds_encode(instring):
             if sys.version_info.major == 2:
-                return instring.encode(ExternalEncoding)
+                if ExternalEncoding:
+                    encoding = ExternalEncoding
+                else:
+                    encoding = 'utf-8'
+                return instring.encode(encoding)
             else:
                 return instring
         @staticmethod
@@ -452,7 +456,7 @@ except ImportError as exp:
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 Tag_pattern_ = re_.compile(r'({.*})?(.*)')
 String_cleanup_pat_ = re_.compile(r"[\n\r\s]+")
 Namespace_extract_pat_ = re_.compile(r'{(.*)}(.*)')
diff --git a/tests/people_procincl1_sub.py b/tests/people_procincl1_sub.py
index 4cac6556acd71509fbeac69f2dcae914f91f71fc..29f7f2774d2a1a6224024b4eb5d0adb8b034dfe5 100644
--- a/tests/people_procincl1_sub.py
+++ b/tests/people_procincl1_sub.py
@@ -41,7 +41,7 @@ def parsexml_(infile, parser=None, **kwargs):
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 
 #
 # Data representation classes
diff --git a/tests/people_procincl1_sup.py b/tests/people_procincl1_sup.py
index 87585435833a5d7a56412502d2851fb87188963a..6b17dac807627f9088b65b11f1c0e4c4fa41e3d8 100644
--- a/tests/people_procincl1_sup.py
+++ b/tests/people_procincl1_sup.py
@@ -405,7 +405,11 @@ except ImportError as exp:
         @staticmethod
         def gds_encode(instring):
             if sys.version_info.major == 2:
-                return instring.encode(ExternalEncoding)
+                if ExternalEncoding:
+                    encoding = ExternalEncoding
+                else:
+                    encoding = 'utf-8'
+                return instring.encode(encoding)
             else:
                 return instring
         @staticmethod
@@ -452,7 +456,7 @@ except ImportError as exp:
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 Tag_pattern_ = re_.compile(r'({.*})?(.*)')
 String_cleanup_pat_ = re_.compile(r"[\n\r\s]+")
 Namespace_extract_pat_ = re_.compile(r'{(.*)}(.*)')
diff --git a/tests/prefix_classname1_sub.py b/tests/prefix_classname1_sub.py
index 22001418265e39fafcbc07bbb2cf5762e1e33d80..41ae7504274932bf361f3f14fc328055082d0327 100644
--- a/tests/prefix_classname1_sub.py
+++ b/tests/prefix_classname1_sub.py
@@ -41,7 +41,7 @@ def parsexml_(infile, parser=None, **kwargs):
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 
 #
 # Data representation classes
diff --git a/tests/prefix_classname1_sup.py b/tests/prefix_classname1_sup.py
index 04ac7be2d087f7529cd7277c5a3bd4c09e472621..97ea7356e9554236fe3dbcb8a56e885c1d46ccf6 100644
--- a/tests/prefix_classname1_sup.py
+++ b/tests/prefix_classname1_sup.py
@@ -405,7 +405,11 @@ except ImportError as exp:
         @staticmethod
         def gds_encode(instring):
             if sys.version_info.major == 2:
-                return instring.encode(ExternalEncoding)
+                if ExternalEncoding:
+                    encoding = ExternalEncoding
+                else:
+                    encoding = 'utf-8'
+                return instring.encode(encoding)
             else:
                 return instring
         @staticmethod
@@ -452,7 +456,7 @@ except ImportError as exp:
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 Tag_pattern_ = re_.compile(r'({.*})?(.*)')
 String_cleanup_pat_ = re_.compile(r"[\n\r\s]+")
 Namespace_extract_pat_ = re_.compile(r'{(.*)}(.*)')
diff --git a/tests/recursive_simpletype1_sub.py b/tests/recursive_simpletype1_sub.py
index acbf3a3a8237a2b05f97112fb07f9cdf1c85124f..92a1ffe5a7455cb4ba0c9cff857923ce5d659f3c 100644
--- a/tests/recursive_simpletype1_sub.py
+++ b/tests/recursive_simpletype1_sub.py
@@ -41,7 +41,7 @@ def parsexml_(infile, parser=None, **kwargs):
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 
 #
 # Data representation classes
diff --git a/tests/recursive_simpletype1_sup.py b/tests/recursive_simpletype1_sup.py
index bb467f4f6446a7d0b0eae10417b14b8e6e6a8055..1de4957ff17039ba6966b4cfa30052118fc49b34 100644
--- a/tests/recursive_simpletype1_sup.py
+++ b/tests/recursive_simpletype1_sup.py
@@ -405,7 +405,11 @@ except ImportError as exp:
         @staticmethod
         def gds_encode(instring):
             if sys.version_info.major == 2:
-                return instring.encode(ExternalEncoding)
+                if ExternalEncoding:
+                    encoding = ExternalEncoding
+                else:
+                    encoding = 'utf-8'
+                return instring.encode(encoding)
             else:
                 return instring
         @staticmethod
@@ -452,7 +456,7 @@ except ImportError as exp:
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 Tag_pattern_ = re_.compile(r'({.*})?(.*)')
 String_cleanup_pat_ = re_.compile(r"[\n\r\s]+")
 Namespace_extract_pat_ = re_.compile(r'{(.*)}(.*)')
diff --git a/tests/reference_simpletype1_sub.py b/tests/reference_simpletype1_sub.py
index 51aff83b3291e75847fef0f3ef0bb43c56d840ab..cd1dd17042d1a5ec67eea06e4f2743699ce20d3d 100644
--- a/tests/reference_simpletype1_sub.py
+++ b/tests/reference_simpletype1_sub.py
@@ -41,7 +41,7 @@ def parsexml_(infile, parser=None, **kwargs):
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 
 #
 # Data representation classes
diff --git a/tests/reference_simpletype1_sup.py b/tests/reference_simpletype1_sup.py
index e9fb502eedf0b179689ffa78c5309557a11923da..a9d6aeab799c487dbaf3d9f80d952e856ab5ad31 100644
--- a/tests/reference_simpletype1_sup.py
+++ b/tests/reference_simpletype1_sup.py
@@ -405,7 +405,11 @@ except ImportError as exp:
         @staticmethod
         def gds_encode(instring):
             if sys.version_info.major == 2:
-                return instring.encode(ExternalEncoding)
+                if ExternalEncoding:
+                    encoding = ExternalEncoding
+                else:
+                    encoding = 'utf-8'
+                return instring.encode(encoding)
             else:
                 return instring
         @staticmethod
@@ -452,7 +456,7 @@ except ImportError as exp:
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 Tag_pattern_ = re_.compile(r'({.*})?(.*)')
 String_cleanup_pat_ = re_.compile(r"[\n\r\s]+")
 Namespace_extract_pat_ = re_.compile(r'{(.*)}(.*)')
diff --git a/tests/rem_dup_elems1_sub.py b/tests/rem_dup_elems1_sub.py
index a4b8c9e02b00e1e6342925a05fa3d2c9bb8bb0fb..bf1dd12233b9517b919611e0b295fa98304fad27 100644
--- a/tests/rem_dup_elems1_sub.py
+++ b/tests/rem_dup_elems1_sub.py
@@ -42,7 +42,7 @@ def parsexml_(infile, parser=None, **kwargs):
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 
 #
 # Data representation classes
diff --git a/tests/rem_dup_elems1_sup.py b/tests/rem_dup_elems1_sup.py
index c4ed8e3e4e52d499a177e4b97584d4d49728b6a4..b5d7dbc6b705220a163bb92d222f8482d74e2a39 100644
--- a/tests/rem_dup_elems1_sup.py
+++ b/tests/rem_dup_elems1_sup.py
@@ -406,7 +406,11 @@ except ImportError as exp:
         @staticmethod
         def gds_encode(instring):
             if sys.version_info.major == 2:
-                return instring.encode(ExternalEncoding)
+                if ExternalEncoding:
+                    encoding = ExternalEncoding
+                else:
+                    encoding = 'utf-8'
+                return instring.encode(encoding)
             else:
                 return instring
         @staticmethod
@@ -453,7 +457,7 @@ except ImportError as exp:
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 Tag_pattern_ = re_.compile(r'({.*})?(.*)')
 String_cleanup_pat_ = re_.compile(r"[\n\r\s]+")
 Namespace_extract_pat_ = re_.compile(r'{(.*)}(.*)')
diff --git a/tests/simplecontent_restriction1_sub.py b/tests/simplecontent_restriction1_sub.py
index 1ff34defc4cf86f4f597ea29a6f7ff716b352199..92cf5fc4ed7505b143789f56a2b12814775f2c7b 100644
--- a/tests/simplecontent_restriction1_sub.py
+++ b/tests/simplecontent_restriction1_sub.py
@@ -41,7 +41,7 @@ def parsexml_(infile, parser=None, **kwargs):
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 
 #
 # Data representation classes
diff --git a/tests/simplecontent_restriction1_sup.py b/tests/simplecontent_restriction1_sup.py
index c1ba056e495cd9cdd0d0ff7dfe5511677f78baf8..dbb315cb4cd236d018ec0a1e9e3c930787576f99 100644
--- a/tests/simplecontent_restriction1_sup.py
+++ b/tests/simplecontent_restriction1_sup.py
@@ -405,7 +405,11 @@ except ImportError as exp:
         @staticmethod
         def gds_encode(instring):
             if sys.version_info.major == 2:
-                return instring.encode(ExternalEncoding)
+                if ExternalEncoding:
+                    encoding = ExternalEncoding
+                else:
+                    encoding = 'utf-8'
+                return instring.encode(encoding)
             else:
                 return instring
         @staticmethod
@@ -452,7 +456,7 @@ except ImportError as exp:
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 Tag_pattern_ = re_.compile(r'({.*})?(.*)')
 String_cleanup_pat_ = re_.compile(r"[\n\r\s]+")
 Namespace_extract_pat_ = re_.compile(r'{(.*)}(.*)')
diff --git a/tests/simpletype_memberspecs1_sub.py b/tests/simpletype_memberspecs1_sub.py
index cce32760a9cc23b3ce8a1dc56cf2071d4cbbba03..c84aacbf135cad34911828e22d41a221a1d1d798 100644
--- a/tests/simpletype_memberspecs1_sub.py
+++ b/tests/simpletype_memberspecs1_sub.py
@@ -41,7 +41,7 @@ def parsexml_(infile, parser=None, **kwargs):
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 
 #
 # Data representation classes
diff --git a/tests/simpletype_memberspecs1_sup.py b/tests/simpletype_memberspecs1_sup.py
index 442879777f2cda805286d047ffd4dd0ed933c4be..bde8f66828d222461e186944fce6ddfd143bc459 100644
--- a/tests/simpletype_memberspecs1_sup.py
+++ b/tests/simpletype_memberspecs1_sup.py
@@ -405,7 +405,11 @@ except ImportError as exp:
         @staticmethod
         def gds_encode(instring):
             if sys.version_info.major == 2:
-                return instring.encode(ExternalEncoding)
+                if ExternalEncoding:
+                    encoding = ExternalEncoding
+                else:
+                    encoding = 'utf-8'
+                return instring.encode(encoding)
             else:
                 return instring
         @staticmethod
@@ -452,7 +456,7 @@ except ImportError as exp:
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 Tag_pattern_ = re_.compile(r'({.*})?(.*)')
 String_cleanup_pat_ = re_.compile(r"[\n\r\s]+")
 Namespace_extract_pat_ = re_.compile(r'{(.*)}(.*)')
diff --git a/tests/simpletypes_other1_sub.py b/tests/simpletypes_other1_sub.py
index 721a1e4481515fb89f07ee0788fd71ec4efd7999..7eef200fa8346b7ac8cec17bfd5fabe52a8f9399 100644
--- a/tests/simpletypes_other1_sub.py
+++ b/tests/simpletypes_other1_sub.py
@@ -41,7 +41,7 @@ def parsexml_(infile, parser=None, **kwargs):
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 
 #
 # Data representation classes
diff --git a/tests/simpletypes_other1_sup.py b/tests/simpletypes_other1_sup.py
index 32ef27f480d52d37d7b0a1be54d893e0827433f8..4c652f6c392141c09fce98823c55d05e6fae90ab 100644
--- a/tests/simpletypes_other1_sup.py
+++ b/tests/simpletypes_other1_sup.py
@@ -405,7 +405,11 @@ except ImportError as exp:
         @staticmethod
         def gds_encode(instring):
             if sys.version_info.major == 2:
-                return instring.encode(ExternalEncoding)
+                if ExternalEncoding:
+                    encoding = ExternalEncoding
+                else:
+                    encoding = 'utf-8'
+                return instring.encode(encoding)
             else:
                 return instring
         @staticmethod
@@ -452,7 +456,7 @@ except ImportError as exp:
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 Tag_pattern_ = re_.compile(r'({.*})?(.*)')
 String_cleanup_pat_ = re_.compile(r"[\n\r\s]+")
 Namespace_extract_pat_ = re_.compile(r'{(.*)}(.*)')
diff --git a/tests/to_etree1_sub.py b/tests/to_etree1_sub.py
index eebd733a6891fc0020e794ca1aefb2a5b8c922d7..83541d07f8e3464334f81ae3849ec727644397ba 100644
--- a/tests/to_etree1_sub.py
+++ b/tests/to_etree1_sub.py
@@ -43,7 +43,7 @@ def parsexml_(infile, parser=None, **kwargs):
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 
 #
 # Data representation classes
diff --git a/tests/to_etree1_sup.py b/tests/to_etree1_sup.py
index f2b634d228b5feff71edb20097ed2527c6754f79..03db65ce2069117cad4028af25d9f12cf474f1ab 100644
--- a/tests/to_etree1_sup.py
+++ b/tests/to_etree1_sup.py
@@ -407,7 +407,11 @@ except ImportError as exp:
         @staticmethod
         def gds_encode(instring):
             if sys.version_info.major == 2:
-                return instring.encode(ExternalEncoding)
+                if ExternalEncoding:
+                    encoding = ExternalEncoding
+                else:
+                    encoding = 'utf-8'
+                return instring.encode(encoding)
             else:
                 return instring
         @staticmethod
@@ -454,7 +458,7 @@ except ImportError as exp:
 # Globals
 #
 
-ExternalEncoding = 'ascii'
+ExternalEncoding = ''
 Tag_pattern_ = re_.compile(r'({.*})?(.*)')
 String_cleanup_pat_ = re_.compile(r"[\n\r\s]+")
 Namespace_extract_pat_ = re_.compile(r'{(.*)}(.*)')
diff --git a/tests/validate_simpletypes1_sup.py b/tests/validate_simpletypes1_sup.py
index a850c1b2eb4d60314f4c6d74cfc9b89dd5826de1..ce081c71957f605f15441e3f16e4859842628014 100644
--- a/tests/validate_simpletypes1_sup.py
+++ b/tests/validate_simpletypes1_sup.py
@@ -405,7 +405,11 @@ except ImportError as exp:
         @staticmethod
         def gds_encode(instring):
             if sys.version_info.major == 2:
-                return instring.encode(ExternalEncoding)
+                if ExternalEncoding:
+                    encoding = ExternalEncoding
+                else:
+                    encoding = 'utf-8'
+                return instring.encode(encoding)
             else:
                 return instring
         @staticmethod
diff --git a/tests/validate_simpletypes1_warnings.txt b/tests/validate_simpletypes1_warnings.txt
index 3f77f4d42e2cd3b8fab82fc84c831a9cc973b38e..388f9362c6317e2eed0714a06bb2e378a6b1e394 100644
--- a/tests/validate_simpletypes1_warnings.txt
+++ b/tests/validate_simpletypes1_warnings.txt
@@ -1,62 +1,62 @@
-tests/validate_simpletypes2_sup.py:1065: UserWarning: Value "2" does not match xsd minExclusive restriction on integer_range_1_st
+tests/validate_simpletypes2_sup.py:1069: UserWarning: Value "2" does not match xsd minExclusive restriction on integer_range_1_st
   warnings_.warn('Value "%(value)s" does not match xsd minExclusive restriction on integer_range_1_st' % {"value" : value} )
-tests/validate_simpletypes2_sup.py:1075: UserWarning: Value "mmaaa1234mnopzzz" does not match xsd pattern restrictions: [[u'^aaa.*zzz$', u'^bbb.*xxx$'], [u'^.*123.*$', u'^.*456.*$']]
+tests/validate_simpletypes2_sup.py:1079: UserWarning: Value "mmaaa1234mnopzzz" does not match xsd pattern restrictions: [[u'^aaa.*zzz$', u'^bbb.*xxx$'], [u'^.*123.*$', u'^.*456.*$']]
   warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_pattern_st_patterns_, ))
-tests/validate_simpletypes2_sup.py:1088: UserWarning: Value "floatxx" does not match xsd enumeration restriction on token_enum_st
+tests/validate_simpletypes2_sup.py:1092: UserWarning: Value "floatxx" does not match xsd enumeration restriction on token_enum_st
   warnings_.warn('Value "%(value)s" does not match xsd enumeration restriction on token_enum_st' % {"value" : value.encode("utf-8")} )
-tests/validate_simpletypes2_sup.py:1095: UserWarning: Value "22" does not match xsd maxInclusive restriction on integer_range_incl_st
+tests/validate_simpletypes2_sup.py:1099: UserWarning: Value "22" does not match xsd maxInclusive restriction on integer_range_incl_st
   warnings_.warn('Value "%(value)s" does not match xsd maxInclusive restriction on integer_range_incl_st' % {"value" : value} )
-tests/validate_simpletypes2_sup.py:1100: UserWarning: Value "-40" does not match xsd minExclusive restriction on integer_range_excl_st
+tests/validate_simpletypes2_sup.py:1104: UserWarning: Value "-40" does not match xsd minExclusive restriction on integer_range_excl_st
   warnings_.warn('Value "%(value)s" does not match xsd minExclusive restriction on integer_range_excl_st' % {"value" : value} )
-tests/validate_simpletypes2_sup.py:1109: UserWarning: Value "mno pqr" does not match xsd minLength restriction on min_max_length_st
+tests/validate_simpletypes2_sup.py:1113: UserWarning: Value "mno pqr" does not match xsd minLength restriction on min_max_length_st
   warnings_.warn('Value "%(value)s" does not match xsd minLength restriction on min_max_length_st' % {"value" : value.encode("utf-8")} )
-tests/validate_simpletypes2_sup.py:1114: UserWarning: Value "012345" does not match xsd length restriction on length_st
+tests/validate_simpletypes2_sup.py:1118: UserWarning: Value "012345" does not match xsd length restriction on length_st
   warnings_.warn('Value "%(value)s" does not match xsd length restriction on length_st' % {"value" : value.encode("utf-8")} )
-tests/validate_simpletypes2_sup.py:1198: UserWarning: Value "0.2" does not match xsd minInclusive restriction on anonymous_float_valueType
+tests/validate_simpletypes2_sup.py:1202: UserWarning: Value "0.2" does not match xsd minInclusive restriction on anonymous_float_valueType
   warnings_.warn('Value "%(value)s" does not match xsd minInclusive restriction on anonymous_float_valueType' % {"value" : value} )
-tests/validate_simpletypes2_sup.py:1185: UserWarning: Value "efgh" does not match xsd pattern restrictions: [[u'^abcd$|^ef\\|gh$']]
+tests/validate_simpletypes2_sup.py:1189: UserWarning: Value "efgh" does not match xsd pattern restrictions: [[u'^abcd$|^ef\\|gh$']]
   warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_vbar_pattern_st_patterns_, ))
-tests/validate_simpletypes2_sup.py:1192: UserWarning: Value "efÄŸh" does not match xsd pattern restrictions: [[u'^ab\xe7d$|^ef\\|gh$']]
+tests/validate_simpletypes2_sup.py:1196: UserWarning: Value "efÄŸh" does not match xsd pattern restrictions: [[u'^ab\xe7d$|^ef\\|gh$']]
   warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_unicode_pattern_st_patterns_, ))
-tests/validate_simpletypes2_sup.py:1067: UserWarning: Value "9" does not match xsd maxExclusive restriction on integer_range_1_st
+tests/validate_simpletypes2_sup.py:1071: UserWarning: Value "9" does not match xsd maxExclusive restriction on integer_range_1_st
   warnings_.warn('Value "%(value)s" does not match xsd maxExclusive restriction on integer_range_1_st' % {"value" : value} )
-tests/validate_simpletypes2_sup.py:1075: UserWarning: Value "aaa1234mnopzzzbcd" does not match xsd pattern restrictions: [[u'^aaa.*zzz$', u'^bbb.*xxx$'], [u'^.*123.*$', u'^.*456.*$']]
+tests/validate_simpletypes2_sup.py:1079: UserWarning: Value "aaa1234mnopzzzbcd" does not match xsd pattern restrictions: [[u'^aaa.*zzz$', u'^bbb.*xxx$'], [u'^.*123.*$', u'^.*456.*$']]
   warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_pattern_st_patterns_, ))
-tests/validate_simpletypes2_sup.py:1093: UserWarning: Value "-50" does not match xsd minInclusive restriction on integer_range_incl_st
+tests/validate_simpletypes2_sup.py:1097: UserWarning: Value "-50" does not match xsd minInclusive restriction on integer_range_incl_st
   warnings_.warn('Value "%(value)s" does not match xsd minInclusive restriction on integer_range_incl_st' % {"value" : value} )
-tests/validate_simpletypes2_sup.py:1107: UserWarning: Value "asdf asdf asdf asdf asdf asdf" does not match xsd maxLength restriction on min_max_length_st
+tests/validate_simpletypes2_sup.py:1111: UserWarning: Value "asdf asdf asdf asdf asdf asdf" does not match xsd maxLength restriction on min_max_length_st
   warnings_.warn('Value "%(value)s" does not match xsd maxLength restriction on min_max_length_st' % {"value" : value.encode("utf-8")} )
-tests/validate_simpletypes2_sup.py:1114: UserWarning: Value "01234567890" does not match xsd length restriction on length_st
+tests/validate_simpletypes2_sup.py:1118: UserWarning: Value "01234567890" does not match xsd length restriction on length_st
   warnings_.warn('Value "%(value)s" does not match xsd length restriction on length_st' % {"value" : value.encode("utf-8")} )
-tests/validate_simpletypes2_sup.py:1124: UserWarning: Value "2015-05-01" does not match xsd minInclusive restriction on date_minincl_st
+tests/validate_simpletypes2_sup.py:1128: UserWarning: Value "2015-05-01" does not match xsd minInclusive restriction on date_minincl_st
   warnings_.warn('Value "%(value)s" does not match xsd minInclusive restriction on date_minincl_st' % {"value" : value} )
-tests/validate_simpletypes2_sup.py:1129: UserWarning: Value "2015-11-01" does not match xsd maxInclusive restriction on date_maxincl_st
+tests/validate_simpletypes2_sup.py:1133: UserWarning: Value "2015-11-01" does not match xsd maxInclusive restriction on date_maxincl_st
   warnings_.warn('Value "%(value)s" does not match xsd maxInclusive restriction on date_maxincl_st' % {"value" : value} )
-tests/validate_simpletypes2_sup.py:1134: UserWarning: Value "2015-05-01" does not match xsd minExclusive restriction on date_minexcl_st
+tests/validate_simpletypes2_sup.py:1138: UserWarning: Value "2015-05-01" does not match xsd minExclusive restriction on date_minexcl_st
   warnings_.warn('Value "%(value)s" does not match xsd minExclusive restriction on date_minexcl_st' % {"value" : value} )
-tests/validate_simpletypes2_sup.py:1139: UserWarning: Value "2015-11-01" does not match xsd maxExclusive restriction on date_maxexcl_st
+tests/validate_simpletypes2_sup.py:1143: UserWarning: Value "2015-11-01" does not match xsd maxExclusive restriction on date_maxexcl_st
   warnings_.warn('Value "%(value)s" does not match xsd maxExclusive restriction on date_maxexcl_st' % {"value" : value} )
-tests/validate_simpletypes2_sup.py:1144: UserWarning: Value "13:30:00" does not match xsd minInclusive restriction on time_minincl_st
+tests/validate_simpletypes2_sup.py:1148: UserWarning: Value "13:30:00" does not match xsd minInclusive restriction on time_minincl_st
   warnings_.warn('Value "%(value)s" does not match xsd minInclusive restriction on time_minincl_st' % {"value" : value} )
-tests/validate_simpletypes2_sup.py:1149: UserWarning: Value "17:00:00" does not match xsd maxInclusive restriction on time_maxincl_st
+tests/validate_simpletypes2_sup.py:1153: UserWarning: Value "17:00:00" does not match xsd maxInclusive restriction on time_maxincl_st
   warnings_.warn('Value "%(value)s" does not match xsd maxInclusive restriction on time_maxincl_st' % {"value" : value} )
-tests/validate_simpletypes2_sup.py:1154: UserWarning: Value "13:30:00" does not match xsd minExclusive restriction on time_minexcl_st
+tests/validate_simpletypes2_sup.py:1158: UserWarning: Value "13:30:00" does not match xsd minExclusive restriction on time_minexcl_st
   warnings_.warn('Value "%(value)s" does not match xsd minExclusive restriction on time_minexcl_st' % {"value" : value} )
-tests/validate_simpletypes2_sup.py:1159: UserWarning: Value "17:00:00" does not match xsd maxExclusive restriction on time_maxexcl_st
+tests/validate_simpletypes2_sup.py:1163: UserWarning: Value "17:00:00" does not match xsd maxExclusive restriction on time_maxexcl_st
   warnings_.warn('Value "%(value)s" does not match xsd maxExclusive restriction on time_maxexcl_st' % {"value" : value} )
-tests/validate_simpletypes2_sup.py:1164: UserWarning: Value "2015-06-01 13:20:10" does not match xsd minInclusive restriction on datetime_minincl_st
+tests/validate_simpletypes2_sup.py:1168: UserWarning: Value "2015-06-01 13:20:10" does not match xsd minInclusive restriction on datetime_minincl_st
   warnings_.warn('Value "%(value)s" does not match xsd minInclusive restriction on datetime_minincl_st' % {"value" : value} )
-tests/validate_simpletypes2_sup.py:1169: UserWarning: Value "2015-11-01 14:20:10" does not match xsd maxInclusive restriction on datetime_maxincl_st
+tests/validate_simpletypes2_sup.py:1173: UserWarning: Value "2015-11-01 14:20:10" does not match xsd maxInclusive restriction on datetime_maxincl_st
   warnings_.warn('Value "%(value)s" does not match xsd maxInclusive restriction on datetime_maxincl_st' % {"value" : value} )
-tests/validate_simpletypes2_sup.py:1174: UserWarning: Value "2015-06-01 13:20:10" does not match xsd minExclusive restriction on datetime_minexcl_st
+tests/validate_simpletypes2_sup.py:1178: UserWarning: Value "2015-06-01 13:20:10" does not match xsd minExclusive restriction on datetime_minexcl_st
   warnings_.warn('Value "%(value)s" does not match xsd minExclusive restriction on datetime_minexcl_st' % {"value" : value} )
-tests/validate_simpletypes2_sup.py:1179: UserWarning: Value "2015-11-01 14:20:10" does not match xsd maxExclusive restriction on datetime_maxexcl_st
+tests/validate_simpletypes2_sup.py:1183: UserWarning: Value "2015-11-01 14:20:10" does not match xsd maxExclusive restriction on datetime_maxexcl_st
   warnings_.warn('Value "%(value)s" does not match xsd maxExclusive restriction on datetime_maxexcl_st' % {"value" : value} )
-tests/validate_simpletypes2_sup.py:1200: UserWarning: Value "6.6" does not match xsd maxInclusive restriction on anonymous_float_valueType
+tests/validate_simpletypes2_sup.py:1204: UserWarning: Value "6.6" does not match xsd maxInclusive restriction on anonymous_float_valueType
   warnings_.warn('Value "%(value)s" does not match xsd maxInclusive restriction on anonymous_float_valueType' % {"value" : value} )
-tests/validate_simpletypes2_sup.py:1072: UserWarning: Value "aaa12zzz" does not match xsd minLength restriction on pattern_st
+tests/validate_simpletypes2_sup.py:1076: UserWarning: Value "aaa12zzz" does not match xsd minLength restriction on pattern_st
   warnings_.warn('Value "%(value)s" does not match xsd minLength restriction on pattern_st' % {"value" : value} )
-tests/validate_simpletypes2_sup.py:1075: UserWarning: Value "aaa12zzz" does not match xsd pattern restrictions: [[u'^aaa.*zzz$', u'^bbb.*xxx$'], [u'^.*123.*$', u'^.*456.*$']]
+tests/validate_simpletypes2_sup.py:1079: UserWarning: Value "aaa12zzz" does not match xsd pattern restrictions: [[u'^aaa.*zzz$', u'^bbb.*xxx$'], [u'^.*123.*$', u'^.*456.*$']]
   warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_pattern_st_patterns_, ))
-tests/validate_simpletypes2_sup.py:1634: UserWarning: Value "pqrst" does not match xsd minLength restriction on simpleTwoElementTwoType
+tests/validate_simpletypes2_sup.py:1638: UserWarning: Value "pqrst" does not match xsd minLength restriction on simpleTwoElementTwoType
   warnings_.warn('Value "%(value)s" does not match xsd minLength restriction on simpleTwoElementTwoType' % {"value" : value.encode("utf-8")} )
diff --git a/tests/validate_simpletypes2_sup.py b/tests/validate_simpletypes2_sup.py
index a850c1b2eb4d60314f4c6d74cfc9b89dd5826de1..ce081c71957f605f15441e3f16e4859842628014 100644
--- a/tests/validate_simpletypes2_sup.py
+++ b/tests/validate_simpletypes2_sup.py
@@ -405,7 +405,11 @@ except ImportError as exp:
         @staticmethod
         def gds_encode(instring):
             if sys.version_info.major == 2:
-                return instring.encode(ExternalEncoding)
+                if ExternalEncoding:
+                    encoding = ExternalEncoding
+                else:
+                    encoding = 'utf-8'
+                return instring.encode(encoding)
             else:
                 return instring
         @staticmethod
diff --git a/tutorial/generateds_tutorial.html b/tutorial/generateds_tutorial.html
index e83274ee93efaf522d3d44c7ac6180e38ae8b14f..61b98a7d83f7cf9678913fcb03d16a5ca301ae7c 100644
--- a/tutorial/generateds_tutorial.html
+++ b/tutorial/generateds_tutorial.html
@@ -219,7 +219,7 @@ They are used by updateversion.py. -->
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
-<tr class="field"><th class="field-name">revision:</th><td class="field-body">2.29.15</td>
+<tr class="field"><th class="field-name">revision:</th><td class="field-body">2.29.16</td>
 </tr>
 </tbody>
 </table>
@@ -228,7 +228,7 @@ They are used by updateversion.py. -->
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
-<tr class="field"><th class="field-name">date:</th><td class="field-body">May 16, 2018</td>
+<tr class="field"><th class="field-name">date:</th><td class="field-body">June 22, 2018</td>
 </tr>
 </tbody>
 </table>
@@ -1210,7 +1210,7 @@ named <tt class="docutils literal">garden_api.py</tt>, you can create an instanc
 <div class="footer">
 <hr class="footer" />
 <a class="reference external" href="generateds_tutorial.txt">View document source</a>.
-Generated on: 2018-05-16 18:03 UTC.
+Generated on: 2018-06-22 18:15 UTC.
 Generated by <a class="reference external" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference external" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
 
 </div>
diff --git a/tutorial/generateds_tutorial.txt b/tutorial/generateds_tutorial.txt
index 0ecea0cf86f7133b2e6597603768fc99468155d3..bcc9207149149b733f24d6d9705b0b2fec578bd5 100644
--- a/tutorial/generateds_tutorial.txt
+++ b/tutorial/generateds_tutorial.txt
@@ -11,7 +11,7 @@ generateDS -- Introduction and Tutorial
 
 .. version
 
-:revision: 2.29.15
+:revision: 2.29.16
 
 .. version
 
diff --git a/tutorial/generateds_tutorial.zip b/tutorial/generateds_tutorial.zip
index b18ad8722656f854b9eb029e232371135ae65b27..5b06aff32c26d6cbb9d89f183ad9ac8bc0dcfa7d 100644
Binary files a/tutorial/generateds_tutorial.zip and b/tutorial/generateds_tutorial.zip differ