diff options
author | Guido van Rossum <guido@python.org> | 2007-07-27 18:03:11 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-07-27 18:03:11 (GMT) |
commit | 3e1f85eb5d20098dd98c941394b2f781dee957d3 (patch) | |
tree | d60e53f916c52ea5e363eb13701e478395726254 /Lib/io.py | |
parent | 3992db81b6c4050a26f7e242b1f16fee245b3127 (diff) | |
download | cpython-3e1f85eb5d20098dd98c941394b2f781dee957d3.zip cpython-3e1f85eb5d20098dd98c941394b2f781dee957d3.tar.gz cpython-3e1f85eb5d20098dd98c941394b2f781dee957d3.tar.bz2 |
Fix the minidom test.
In order to do this, I added an optional encoding argument to io.StringIO.
The toprettyxml() function returns bytes when you specify an encoding now.
Diffstat (limited to 'Lib/io.py')
-rw-r--r-- | Lib/io.py | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -1262,11 +1262,13 @@ class StringIO(TextIOWrapper): # XXX This is really slow, but fully functional - def __init__(self, initial_value=""): - super(StringIO, self).__init__(BytesIO(), "utf-8") + def __init__(self, initial_value="", encoding="utf-8", newline=None): + super(StringIO, self).__init__(BytesIO(), + encoding=encoding, + newline=newline) if initial_value: self.write(initial_value) self.seek(0) def getvalue(self): - return self.buffer.getvalue().decode("utf-8") + return self.buffer.getvalue().decode(self._encoding) |