cp1255.py 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. """ Python Character Mapping Codec generated from 'CP1255.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. 0x0080: 0x20ac, # EURO SIGN
  24. 0x0081: None, # UNDEFINED
  25. 0x0082: 0x201a, # SINGLE LOW-9 QUOTATION MARK
  26. 0x0083: 0x0192, # LATIN SMALL LETTER F WITH HOOK
  27. 0x0084: 0x201e, # DOUBLE LOW-9 QUOTATION MARK
  28. 0x0085: 0x2026, # HORIZONTAL ELLIPSIS
  29. 0x0086: 0x2020, # DAGGER
  30. 0x0087: 0x2021, # DOUBLE DAGGER
  31. 0x0088: 0x02c6, # MODIFIER LETTER CIRCUMFLEX ACCENT
  32. 0x0089: 0x2030, # PER MILLE SIGN
  33. 0x008a: None, # UNDEFINED
  34. 0x008b: 0x2039, # SINGLE LEFT-POINTING ANGLE QUOTATION MARK
  35. 0x008c: None, # UNDEFINED
  36. 0x008d: None, # UNDEFINED
  37. 0x008e: None, # UNDEFINED
  38. 0x008f: None, # UNDEFINED
  39. 0x0090: None, # UNDEFINED
  40. 0x0091: 0x2018, # LEFT SINGLE QUOTATION MARK
  41. 0x0092: 0x2019, # RIGHT SINGLE QUOTATION MARK
  42. 0x0093: 0x201c, # LEFT DOUBLE QUOTATION MARK
  43. 0x0094: 0x201d, # RIGHT DOUBLE QUOTATION MARK
  44. 0x0095: 0x2022, # BULLET
  45. 0x0096: 0x2013, # EN DASH
  46. 0x0097: 0x2014, # EM DASH
  47. 0x0098: 0x02dc, # SMALL TILDE
  48. 0x0099: 0x2122, # TRADE MARK SIGN
  49. 0x009a: None, # UNDEFINED
  50. 0x009b: 0x203a, # SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
  51. 0x009c: None, # UNDEFINED
  52. 0x009d: None, # UNDEFINED
  53. 0x009e: None, # UNDEFINED
  54. 0x009f: None, # UNDEFINED
  55. 0x00a4: 0x20aa, # NEW SHEQEL SIGN
  56. 0x00aa: 0x00d7, # MULTIPLICATION SIGN
  57. 0x00ba: 0x00f7, # DIVISION SIGN
  58. 0x00c0: 0x05b0, # HEBREW POINT SHEVA
  59. 0x00c1: 0x05b1, # HEBREW POINT HATAF SEGOL
  60. 0x00c2: 0x05b2, # HEBREW POINT HATAF PATAH
  61. 0x00c3: 0x05b3, # HEBREW POINT HATAF QAMATS
  62. 0x00c4: 0x05b4, # HEBREW POINT HIRIQ
  63. 0x00c5: 0x05b5, # HEBREW POINT TSERE
  64. 0x00c6: 0x05b6, # HEBREW POINT SEGOL
  65. 0x00c7: 0x05b7, # HEBREW POINT PATAH
  66. 0x00c8: 0x05b8, # HEBREW POINT QAMATS
  67. 0x00c9: 0x05b9, # HEBREW POINT HOLAM
  68. 0x00ca: None, # UNDEFINED
  69. 0x00cb: 0x05bb, # HEBREW POINT QUBUTS
  70. 0x00cc: 0x05bc, # HEBREW POINT DAGESH OR MAPIQ
  71. 0x00cd: 0x05bd, # HEBREW POINT METEG
  72. 0x00ce: 0x05be, # HEBREW PUNCTUATION MAQAF
  73. 0x00cf: 0x05bf, # HEBREW POINT RAFE
  74. 0x00d0: 0x05c0, # HEBREW PUNCTUATION PASEQ
  75. 0x00d1: 0x05c1, # HEBREW POINT SHIN DOT
  76. 0x00d2: 0x05c2, # HEBREW POINT SIN DOT
  77. 0x00d3: 0x05c3, # HEBREW PUNCTUATION SOF PASUQ
  78. 0x00d4: 0x05f0, # HEBREW LIGATURE YIDDISH DOUBLE VAV
  79. 0x00d5: 0x05f1, # HEBREW LIGATURE YIDDISH VAV YOD
  80. 0x00d6: 0x05f2, # HEBREW LIGATURE YIDDISH DOUBLE YOD
  81. 0x00d7: 0x05f3, # HEBREW PUNCTUATION GERESH
  82. 0x00d8: 0x05f4, # HEBREW PUNCTUATION GERSHAYIM
  83. 0x00d9: None, # UNDEFINED
  84. 0x00da: None, # UNDEFINED
  85. 0x00db: None, # UNDEFINED
  86. 0x00dc: None, # UNDEFINED
  87. 0x00dd: None, # UNDEFINED
  88. 0x00de: None, # UNDEFINED
  89. 0x00df: None, # UNDEFINED
  90. 0x00e0: 0x05d0, # HEBREW LETTER ALEF
  91. 0x00e1: 0x05d1, # HEBREW LETTER BET
  92. 0x00e2: 0x05d2, # HEBREW LETTER GIMEL
  93. 0x00e3: 0x05d3, # HEBREW LETTER DALET
  94. 0x00e4: 0x05d4, # HEBREW LETTER HE
  95. 0x00e5: 0x05d5, # HEBREW LETTER VAV
  96. 0x00e6: 0x05d6, # HEBREW LETTER ZAYIN
  97. 0x00e7: 0x05d7, # HEBREW LETTER HET
  98. 0x00e8: 0x05d8, # HEBREW LETTER TET
  99. 0x00e9: 0x05d9, # HEBREW LETTER YOD
  100. 0x00ea: 0x05da, # HEBREW LETTER FINAL KAF
  101. 0x00eb: 0x05db, # HEBREW LETTER KAF
  102. 0x00ec: 0x05dc, # HEBREW LETTER LAMED
  103. 0x00ed: 0x05dd, # HEBREW LETTER FINAL MEM
  104. 0x00ee: 0x05de, # HEBREW LETTER MEM
  105. 0x00ef: 0x05df, # HEBREW LETTER FINAL NUN
  106. 0x00f0: 0x05e0, # HEBREW LETTER NUN
  107. 0x00f1: 0x05e1, # HEBREW LETTER SAMEKH
  108. 0x00f2: 0x05e2, # HEBREW LETTER AYIN
  109. 0x00f3: 0x05e3, # HEBREW LETTER FINAL PE
  110. 0x00f4: 0x05e4, # HEBREW LETTER PE
  111. 0x00f5: 0x05e5, # HEBREW LETTER FINAL TSADI
  112. 0x00f6: 0x05e6, # HEBREW LETTER TSADI
  113. 0x00f7: 0x05e7, # HEBREW LETTER QOF
  114. 0x00f8: 0x05e8, # HEBREW LETTER RESH
  115. 0x00f9: 0x05e9, # HEBREW LETTER SHIN
  116. 0x00fa: 0x05ea, # HEBREW LETTER TAV
  117. 0x00fb: None, # UNDEFINED
  118. 0x00fc: None, # UNDEFINED
  119. 0x00fd: 0x200e, # LEFT-TO-RIGHT MARK
  120. 0x00fe: 0x200f, # RIGHT-TO-LEFT MARK
  121. 0x00ff: None, # UNDEFINED
  122. })
  123. ### Encoding Map
  124. encoding_map = codecs.make_encoding_map(decoding_map)