You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

iso8859_9.py 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. """ Python Character Mapping Codec generated from '8859-9.TXT' with gencodec.py.
  2. Written by Marc-Andre Lemburg (mal@lemburg.com).
  3. (c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
  4. (c) Copyright 2000 Guido van Rossum.
  5. """#"
  6. import codecs
  7. ### Codec APIs
  8. class Codec(codecs.Codec):
  9. def encode(self,input,errors='strict'):
  10. return codecs.charmap_encode(input,errors,encoding_map)
  11. def decode(self,input,errors='strict'):
  12. return codecs.charmap_decode(input,errors,decoding_map)
  13. class StreamWriter(Codec,codecs.StreamWriter):
  14. pass
  15. class StreamReader(Codec,codecs.StreamReader):
  16. pass
  17. ### encodings module API
  18. def getregentry():
  19. return (Codec().encode,Codec().decode,StreamReader,StreamWriter)
  20. ### Decoding Map
  21. decoding_map = codecs.make_identity_dict(range(256))
  22. decoding_map.update({
  23. 0x00d0: 0x011e, # LATIN CAPITAL LETTER G WITH BREVE
  24. 0x00dd: 0x0130, # LATIN CAPITAL LETTER I WITH DOT ABOVE
  25. 0x00de: 0x015e, # LATIN CAPITAL LETTER S WITH CEDILLA
  26. 0x00f0: 0x011f, # LATIN SMALL LETTER G WITH BREVE
  27. 0x00fd: 0x0131, # LATIN SMALL LETTER DOTLESS I
  28. 0x00fe: 0x015f, # LATIN SMALL LETTER S WITH CEDILLA
  29. })
  30. ### Encoding Map
  31. encoding_map = {}
  32. for k,v in decoding_map.items():
  33. encoding_map[v] = k