=== cElementTree.c
==================================================================
--- cElementTree.c	(revision 54)
+++ cElementTree.c	(local)
@@ -33,6 +33,7 @@
  * 2005-08-11 fl  added runtime test for copy workaround (1.0.3)
  * 2005-12-13 fl  added expat_capi support (for xml.etree) (1.0.4)
  * 2005-12-16 fl  added support for non-standard encodings
+ * 2006-02-03 bi  determine endian from Python.h, not sys.byteorder
  *
  * Copyright (c) 1999-2005 by Secret Labs AB.  All rights reserved.
  * Copyright (c) 1999-2005 by Fredrik Lundh.
=== selftest.py
==================================================================
--- selftest.py	(revision 54)
+++ selftest.py	(local)
@@ -301,6 +301,18 @@
 
     """
 
+def utf16():
+    """
+    Test UTF-16 handling
+
+    >>> serialize(unserialize(u"<tag>hello</tag>".encode('utf-16-be')))
+    '<tag>hello</tag>'
+    >>> serialize(unserialize(u"<tag>hello</tag>".encode('utf-16-le')))
+    '<tag>hello</tag>'
+    >>> serialize(unserialize(u"<tag>hello</tag>".encode('utf-16')))
+    '<tag>hello</tag>'
+    """
+
 def cdata():
     """
     Test CDATA handling (etc).
=== setup.py
==================================================================
--- setup.py	(revision 54)
+++ setup.py	(local)
@@ -49,10 +49,7 @@
             defines.append((feature_macro, "1"))
     defines.append(("XML_NS", "1"))
     defines.append(("XML_DTD", "1"))
-    if sys.byteorder == "little":
-        defines.append(("BYTEORDER", "1234"))
-    else:
-        defines.append(("BYTEORDER", "4321"))
+    defines.append(("HAVE_EXPAT_CONFIG_H", "1"))
     defines.append(("XML_CONTEXT_BYTES", "1024"))
 
 
=== expat_config.h
==================================================================
--- expat_config.h	(revision 54)
+++ expat_config.h	(local)
@@ -0,0 +1,9 @@
+#include "Python.h"
+#ifdef BYTEORDER
+#undef BYTEORDER
+#endif
+#ifdef WORDS_BIGENDIAN
+#define BYTEORDER 4321
+#else
+#define BYTEORDER 1234
+#endif
