Fixed issue-number mistake in NEWS update.
[python.git] / Lib / encodings / utf_7.py
blob8e0567f2087d65e33b3152b8240bcaf703d855fb
1 """ Python 'utf-7' Codec
3 Written by Brian Quinlan (brian@sweetapp.com).
4 """
5 import codecs
7 ### Codec APIs
9 encode = codecs.utf_7_encode
11 def decode(input, errors='strict'):
12 return codecs.utf_7_decode(input, errors, True)
14 class IncrementalEncoder(codecs.IncrementalEncoder):
15 def encode(self, input, final=False):
16 return codecs.utf_7_encode(input, self.errors)[0]
18 class IncrementalDecoder(codecs.BufferedIncrementalDecoder):
19 _buffer_decode = codecs.utf_7_decode
21 class StreamWriter(codecs.StreamWriter):
22 encode = codecs.utf_7_encode
24 class StreamReader(codecs.StreamReader):
25 decode = codecs.utf_7_decode
27 ### encodings module API
29 def getregentry():
30 return codecs.CodecInfo(
31 name='utf-7',
32 encode=encode,
33 decode=decode,
34 incrementalencoder=IncrementalEncoder,
35 incrementaldecoder=IncrementalDecoder,
36 streamreader=StreamReader,
37 streamwriter=StreamWriter,