summaryrefslogtreecommitdiffstats
path: root/Lib/encodings/latin_1.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/encodings/latin_1.py')
-rw-r--r--Lib/encodings/latin_1.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/Lib/encodings/latin_1.py b/Lib/encodings/latin_1.py
index 0e55917..b2a0839 100644
--- a/Lib/encodings/latin_1.py
+++ b/Lib/encodings/latin_1.py
@@ -17,6 +17,14 @@ class Codec(codecs.Codec):
encode = codecs.latin_1_encode
decode = codecs.latin_1_decode
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.latin_1_encode(input,self.errors)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.latin_1_decode(input,self.errors)[0]
+
class StreamWriter(Codec,codecs.StreamWriter):
pass
@@ -31,5 +39,13 @@ class StreamConverter(StreamWriter,StreamReader):
### encodings module API
def getregentry():
+ return codecs.CodecInfo(
+ name='iso8859-1',
+ encode=Codec.encode,
+ decode=Codec.decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
- return (Codec.encode,Codec.decode,StreamReader,StreamWriter)