Guido van Rossum | 1abd82c | 2000-03-28 01:58:50 +0000 | [diff] [blame] | 1 | """ Python 'mbcs' Codec for Windows |
| 2 | |
| 3 | |
| 4 | Cloned by Mark Hammond (mhammond@skippinet.com.au) from ascii.py, |
| 5 | which was written by Marc-Andre Lemburg (mal@lemburg.com). |
| 6 | |
| 7 | (c) Copyright CNRI, All Rights Reserved. NO WARRANTY. |
| 8 | |
| 9 | """ |
| 10 | import codecs |
| 11 | |
| 12 | ### Codec APIs |
| 13 | |
| 14 | class Codec(codecs.Codec): |
| 15 | |
| 16 | # Note: Binding these as C functions will result in the class not |
| 17 | # converting them to methods. This is intended. |
| 18 | encode = codecs.mbcs_encode |
| 19 | decode = codecs.mbcs_decode |
| 20 | |
| 21 | class StreamWriter(Codec,codecs.StreamWriter): |
| 22 | pass |
| 23 | |
| 24 | class StreamReader(Codec,codecs.StreamReader): |
| 25 | pass |
| 26 | |
| 27 | class StreamConverter(StreamWriter,StreamReader): |
| 28 | |
| 29 | encode = codecs.mbcs_decode |
| 30 | decode = codecs.mbcs_encode |
| 31 | |
| 32 | ### encodings module API |
| 33 | |
| 34 | def getregentry(): |
| 35 | |
| 36 | return (Codec.encode,Codec.decode,StreamReader,StreamWriter) |