651
Comment:
|
998
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
The Python2.5's {{{codecs.StreamReaderWriter}}} combines StreamReader and StreamWriter. | The Python2.5's {{{codecs.StreamReaderWriter}}} combines StreamReader and StreamWritet. The wrapper will read narrow {{{str}}} strings from the underlying stream and decode them to {{{unicode}}} strings. On writing {{{unicode}}} data to the wrapper, it will encode them to narrow {{{str}}} strings. The user of the wrapper should specify character sets by supplying class definitions for the respective stream reader and writer. |
The Python2.5's codecs.StreamReaderWriter combines StreamReader and StreamWritet. The wrapper will read narrow str strings from the underlying stream and decode them to unicode strings. On writing unicode data to the wrapper, it will encode them to narrow str strings.
The user of the wrapper should specify character sets by supplying class definitions for the respective stream reader and writer.
Pseudocode:
The codecs module defines a function codecs.open(name, encoding) that returns an instance of StreamReaderWriter configured with the supplied encoding.
See also: StreamReader, StreamWriter, StreamRecoder.