iso8859_13.py 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. """ Python Character Mapping Codec generated from '8859-13.TXT' with gencodec.py.
  2. Written by Marc-Andre Lemburg ([email protected]).
  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. 0x00a1: 0x201d, # RIGHT DOUBLE QUOTATION MARK
  24. 0x00a5: 0x201e, # DOUBLE LOW-9 QUOTATION MARK
  25. 0x00a8: 0x00d8, # LATIN CAPITAL LETTER O WITH STROKE
  26. 0x00aa: 0x0156, # LATIN CAPITAL LETTER R WITH CEDILLA
  27. 0x00af: 0x00c6, # LATIN CAPITAL LETTER AE
  28. 0x00b4: 0x201c, # LEFT DOUBLE QUOTATION MARK
  29. 0x00b8: 0x00f8, # LATIN SMALL LETTER O WITH STROKE
  30. 0x00ba: 0x0157, # LATIN SMALL LETTER R WITH CEDILLA
  31. 0x00bf: 0x00e6, # LATIN SMALL LETTER AE
  32. 0x00c0: 0x0104, # LATIN CAPITAL LETTER A WITH OGONEK
  33. 0x00c1: 0x012e, # LATIN CAPITAL LETTER I WITH OGONEK
  34. 0x00c2: 0x0100, # LATIN CAPITAL LETTER A WITH MACRON
  35. 0x00c3: 0x0106, # LATIN CAPITAL LETTER C WITH ACUTE
  36. 0x00c6: 0x0118, # LATIN CAPITAL LETTER E WITH OGONEK
  37. 0x00c7: 0x0112, # LATIN CAPITAL LETTER E WITH MACRON
  38. 0x00c8: 0x010c, # LATIN CAPITAL LETTER C WITH CARON
  39. 0x00ca: 0x0179, # LATIN CAPITAL LETTER Z WITH ACUTE
  40. 0x00cb: 0x0116, # LATIN CAPITAL LETTER E WITH DOT ABOVE
  41. 0x00cc: 0x0122, # LATIN CAPITAL LETTER G WITH CEDILLA
  42. 0x00cd: 0x0136, # LATIN CAPITAL LETTER K WITH CEDILLA
  43. 0x00ce: 0x012a, # LATIN CAPITAL LETTER I WITH MACRON
  44. 0x00cf: 0x013b, # LATIN CAPITAL LETTER L WITH CEDILLA
  45. 0x00d0: 0x0160, # LATIN CAPITAL LETTER S WITH CARON
  46. 0x00d1: 0x0143, # LATIN CAPITAL LETTER N WITH ACUTE
  47. 0x00d2: 0x0145, # LATIN CAPITAL LETTER N WITH CEDILLA
  48. 0x00d4: 0x014c, # LATIN CAPITAL LETTER O WITH MACRON
  49. 0x00d8: 0x0172, # LATIN CAPITAL LETTER U WITH OGONEK
  50. 0x00d9: 0x0141, # LATIN CAPITAL LETTER L WITH STROKE
  51. 0x00da: 0x015a, # LATIN CAPITAL LETTER S WITH ACUTE
  52. 0x00db: 0x016a, # LATIN CAPITAL LETTER U WITH MACRON
  53. 0x00dd: 0x017b, # LATIN CAPITAL LETTER Z WITH DOT ABOVE
  54. 0x00de: 0x017d, # LATIN CAPITAL LETTER Z WITH CARON
  55. 0x00e0: 0x0105, # LATIN SMALL LETTER A WITH OGONEK
  56. 0x00e1: 0x012f, # LATIN SMALL LETTER I WITH OGONEK
  57. 0x00e2: 0x0101, # LATIN SMALL LETTER A WITH MACRON
  58. 0x00e3: 0x0107, # LATIN SMALL LETTER C WITH ACUTE
  59. 0x00e6: 0x0119, # LATIN SMALL LETTER E WITH OGONEK
  60. 0x00e7: 0x0113, # LATIN SMALL LETTER E WITH MACRON
  61. 0x00e8: 0x010d, # LATIN SMALL LETTER C WITH CARON
  62. 0x00ea: 0x017a, # LATIN SMALL LETTER Z WITH ACUTE
  63. 0x00eb: 0x0117, # LATIN SMALL LETTER E WITH DOT ABOVE
  64. 0x00ec: 0x0123, # LATIN SMALL LETTER G WITH CEDILLA
  65. 0x00ed: 0x0137, # LATIN SMALL LETTER K WITH CEDILLA
  66. 0x00ee: 0x012b, # LATIN SMALL LETTER I WITH MACRON
  67. 0x00ef: 0x013c, # LATIN SMALL LETTER L WITH CEDILLA
  68. 0x00f0: 0x0161, # LATIN SMALL LETTER S WITH CARON
  69. 0x00f1: 0x0144, # LATIN SMALL LETTER N WITH ACUTE
  70. 0x00f2: 0x0146, # LATIN SMALL LETTER N WITH CEDILLA
  71. 0x00f4: 0x014d, # LATIN SMALL LETTER O WITH MACRON
  72. 0x00f8: 0x0173, # LATIN SMALL LETTER U WITH OGONEK
  73. 0x00f9: 0x0142, # LATIN SMALL LETTER L WITH STROKE
  74. 0x00fa: 0x015b, # LATIN SMALL LETTER S WITH ACUTE
  75. 0x00fb: 0x016b, # LATIN SMALL LETTER U WITH MACRON
  76. 0x00fd: 0x017c, # LATIN SMALL LETTER Z WITH DOT ABOVE
  77. 0x00fe: 0x017e, # LATIN SMALL LETTER Z WITH CARON
  78. 0x00ff: 0x2019, # RIGHT SINGLE QUOTATION MARK
  79. })
  80. ### Encoding Map
  81. encoding_map = codecs.make_encoding_map(decoding_map)