OpenScienceFramework/pydocx — pull request #47 by jlward (2013-07-02 15:11:54+00:00)
Title: It is possible for a UnicodeEncodeError to occur when stripping the namespace

```
File "/home/policystat/env/lib/python2.6/site-packages/pydocx/DocxParser.py", line 108, in __init__
self._build_data(path, *args, **kwargs)
File "/home/policystat/env/lib/python2.6/site-packages/pydocx/DocxParser.py", line 72, in _build_data
self.root = parse_xml_from_string(self.document_text)
File "/home/policystat/env/lib/python2.6/site-packages/pydocx/utils.py", line 420, in parse_xml_from_string
return cElementTree.fromstring(remove_namespaces(xml))
File "/home/policystat/env/lib/python2.6/site-packages/pydocx/utils.py", line 78, in remove_namespaces
return cElementTree.tostring(root)
File "/usr/lib/python2.6/xml/etree/ElementTree.py", line 1009, in tostring
ElementTree(element).write(file, encoding)
File "/usr/lib/python2.6/xml/etree/ElementTree.py", line 663, in write
self._write(file, self._root, encoding, {})
File "/usr/lib/python2.6/xml/etree/ElementTree.py", line 707, in _write
self._write(file, n, encoding, namespaces)
File "/usr/lib/python2.6/xml/etree/ElementTree.py", line 707, in _write
self._write(file, n, encoding, namespaces)
File "/usr/lib/python2.6/xml/etree/ElementTree.py", line 707, in _write
self._write(file, n, encoding, namespaces)
File "/usr/lib/python2.6/xml/etree/ElementTree.py", line 707, in _write
self._write(file, n, encoding, namespaces)
File "/usr/lib/python2.6/xml/etree/ElementTree.py", line 705, in _write
file.write(_escape_cdata(node.text, encoding))
File "/usr/lib/python2.6/xml/etree/ElementTree.py", line 807, in _escape_cdata
return _encode_entity(text)
File "/usr/lib/python2.6/xml/etree/ElementTree.py", line 792, in _encode_entity
return _encode(pattern.sub(escape_entities, text), "ascii")
File "/usr/lib/python2.6/xml/etree/ElementTree.py", line 751, in _encode
return s.encode(encoding)
UnicodeEncodeError: 'ascii' codec can't encode character u'\U0010001f' in position 0: ordinal not in range(128)
```

Figure out the encoding of the document and pass that into `tostring`