Funktionierender Prototyp des Serious Games zur Vermittlung von Wissen zu Software-Engineering-Arbeitsmodellen.
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.

constant.py 19KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495
  1. from codecs import BOM_UTF8, BOM_UTF16_BE, BOM_UTF16_LE, BOM_UTF32_BE, BOM_UTF32_LE
  2. from encodings.aliases import aliases
  3. from re import IGNORECASE, compile as re_compile
  4. from typing import Dict, List, Set, Union
  5. from .assets import FREQUENCIES
  6. # Contain for each eligible encoding a list of/item bytes SIG/BOM
  7. ENCODING_MARKS: Dict[str, Union[bytes, List[bytes]]] = {
  8. "utf_8": BOM_UTF8,
  9. "utf_7": [
  10. b"\x2b\x2f\x76\x38",
  11. b"\x2b\x2f\x76\x39",
  12. b"\x2b\x2f\x76\x2b",
  13. b"\x2b\x2f\x76\x2f",
  14. b"\x2b\x2f\x76\x38\x2d",
  15. ],
  16. "gb18030": b"\x84\x31\x95\x33",
  17. "utf_32": [BOM_UTF32_BE, BOM_UTF32_LE],
  18. "utf_16": [BOM_UTF16_BE, BOM_UTF16_LE],
  19. }
  20. TOO_SMALL_SEQUENCE: int = 32
  21. TOO_BIG_SEQUENCE: int = int(10e6)
  22. UTF8_MAXIMAL_ALLOCATION: int = 1112064
  23. UNICODE_RANGES_COMBINED: Dict[str, range] = {
  24. "Control character": range(31 + 1),
  25. "Basic Latin": range(32, 127 + 1),
  26. "Latin-1 Supplement": range(128, 255 + 1),
  27. "Latin Extended-A": range(256, 383 + 1),
  28. "Latin Extended-B": range(384, 591 + 1),
  29. "IPA Extensions": range(592, 687 + 1),
  30. "Spacing Modifier Letters": range(688, 767 + 1),
  31. "Combining Diacritical Marks": range(768, 879 + 1),
  32. "Greek and Coptic": range(880, 1023 + 1),
  33. "Cyrillic": range(1024, 1279 + 1),
  34. "Cyrillic Supplement": range(1280, 1327 + 1),
  35. "Armenian": range(1328, 1423 + 1),
  36. "Hebrew": range(1424, 1535 + 1),
  37. "Arabic": range(1536, 1791 + 1),
  38. "Syriac": range(1792, 1871 + 1),
  39. "Arabic Supplement": range(1872, 1919 + 1),
  40. "Thaana": range(1920, 1983 + 1),
  41. "NKo": range(1984, 2047 + 1),
  42. "Samaritan": range(2048, 2111 + 1),
  43. "Mandaic": range(2112, 2143 + 1),
  44. "Syriac Supplement": range(2144, 2159 + 1),
  45. "Arabic Extended-A": range(2208, 2303 + 1),
  46. "Devanagari": range(2304, 2431 + 1),
  47. "Bengali": range(2432, 2559 + 1),
  48. "Gurmukhi": range(2560, 2687 + 1),
  49. "Gujarati": range(2688, 2815 + 1),
  50. "Oriya": range(2816, 2943 + 1),
  51. "Tamil": range(2944, 3071 + 1),
  52. "Telugu": range(3072, 3199 + 1),
  53. "Kannada": range(3200, 3327 + 1),
  54. "Malayalam": range(3328, 3455 + 1),
  55. "Sinhala": range(3456, 3583 + 1),
  56. "Thai": range(3584, 3711 + 1),
  57. "Lao": range(3712, 3839 + 1),
  58. "Tibetan": range(3840, 4095 + 1),
  59. "Myanmar": range(4096, 4255 + 1),
  60. "Georgian": range(4256, 4351 + 1),
  61. "Hangul Jamo": range(4352, 4607 + 1),
  62. "Ethiopic": range(4608, 4991 + 1),
  63. "Ethiopic Supplement": range(4992, 5023 + 1),
  64. "Cherokee": range(5024, 5119 + 1),
  65. "Unified Canadian Aboriginal Syllabics": range(5120, 5759 + 1),
  66. "Ogham": range(5760, 5791 + 1),
  67. "Runic": range(5792, 5887 + 1),
  68. "Tagalog": range(5888, 5919 + 1),
  69. "Hanunoo": range(5920, 5951 + 1),
  70. "Buhid": range(5952, 5983 + 1),
  71. "Tagbanwa": range(5984, 6015 + 1),
  72. "Khmer": range(6016, 6143 + 1),
  73. "Mongolian": range(6144, 6319 + 1),
  74. "Unified Canadian Aboriginal Syllabics Extended": range(6320, 6399 + 1),
  75. "Limbu": range(6400, 6479 + 1),
  76. "Tai Le": range(6480, 6527 + 1),
  77. "New Tai Lue": range(6528, 6623 + 1),
  78. "Khmer Symbols": range(6624, 6655 + 1),
  79. "Buginese": range(6656, 6687 + 1),
  80. "Tai Tham": range(6688, 6831 + 1),
  81. "Combining Diacritical Marks Extended": range(6832, 6911 + 1),
  82. "Balinese": range(6912, 7039 + 1),
  83. "Sundanese": range(7040, 7103 + 1),
  84. "Batak": range(7104, 7167 + 1),
  85. "Lepcha": range(7168, 7247 + 1),
  86. "Ol Chiki": range(7248, 7295 + 1),
  87. "Cyrillic Extended C": range(7296, 7311 + 1),
  88. "Sundanese Supplement": range(7360, 7375 + 1),
  89. "Vedic Extensions": range(7376, 7423 + 1),
  90. "Phonetic Extensions": range(7424, 7551 + 1),
  91. "Phonetic Extensions Supplement": range(7552, 7615 + 1),
  92. "Combining Diacritical Marks Supplement": range(7616, 7679 + 1),
  93. "Latin Extended Additional": range(7680, 7935 + 1),
  94. "Greek Extended": range(7936, 8191 + 1),
  95. "General Punctuation": range(8192, 8303 + 1),
  96. "Superscripts and Subscripts": range(8304, 8351 + 1),
  97. "Currency Symbols": range(8352, 8399 + 1),
  98. "Combining Diacritical Marks for Symbols": range(8400, 8447 + 1),
  99. "Letterlike Symbols": range(8448, 8527 + 1),
  100. "Number Forms": range(8528, 8591 + 1),
  101. "Arrows": range(8592, 8703 + 1),
  102. "Mathematical Operators": range(8704, 8959 + 1),
  103. "Miscellaneous Technical": range(8960, 9215 + 1),
  104. "Control Pictures": range(9216, 9279 + 1),
  105. "Optical Character Recognition": range(9280, 9311 + 1),
  106. "Enclosed Alphanumerics": range(9312, 9471 + 1),
  107. "Box Drawing": range(9472, 9599 + 1),
  108. "Block Elements": range(9600, 9631 + 1),
  109. "Geometric Shapes": range(9632, 9727 + 1),
  110. "Miscellaneous Symbols": range(9728, 9983 + 1),
  111. "Dingbats": range(9984, 10175 + 1),
  112. "Miscellaneous Mathematical Symbols-A": range(10176, 10223 + 1),
  113. "Supplemental Arrows-A": range(10224, 10239 + 1),
  114. "Braille Patterns": range(10240, 10495 + 1),
  115. "Supplemental Arrows-B": range(10496, 10623 + 1),
  116. "Miscellaneous Mathematical Symbols-B": range(10624, 10751 + 1),
  117. "Supplemental Mathematical Operators": range(10752, 11007 + 1),
  118. "Miscellaneous Symbols and Arrows": range(11008, 11263 + 1),
  119. "Glagolitic": range(11264, 11359 + 1),
  120. "Latin Extended-C": range(11360, 11391 + 1),
  121. "Coptic": range(11392, 11519 + 1),
  122. "Georgian Supplement": range(11520, 11567 + 1),
  123. "Tifinagh": range(11568, 11647 + 1),
  124. "Ethiopic Extended": range(11648, 11743 + 1),
  125. "Cyrillic Extended-A": range(11744, 11775 + 1),
  126. "Supplemental Punctuation": range(11776, 11903 + 1),
  127. "CJK Radicals Supplement": range(11904, 12031 + 1),
  128. "Kangxi Radicals": range(12032, 12255 + 1),
  129. "Ideographic Description Characters": range(12272, 12287 + 1),
  130. "CJK Symbols and Punctuation": range(12288, 12351 + 1),
  131. "Hiragana": range(12352, 12447 + 1),
  132. "Katakana": range(12448, 12543 + 1),
  133. "Bopomofo": range(12544, 12591 + 1),
  134. "Hangul Compatibility Jamo": range(12592, 12687 + 1),
  135. "Kanbun": range(12688, 12703 + 1),
  136. "Bopomofo Extended": range(12704, 12735 + 1),
  137. "CJK Strokes": range(12736, 12783 + 1),
  138. "Katakana Phonetic Extensions": range(12784, 12799 + 1),
  139. "Enclosed CJK Letters and Months": range(12800, 13055 + 1),
  140. "CJK Compatibility": range(13056, 13311 + 1),
  141. "CJK Unified Ideographs Extension A": range(13312, 19903 + 1),
  142. "Yijing Hexagram Symbols": range(19904, 19967 + 1),
  143. "CJK Unified Ideographs": range(19968, 40959 + 1),
  144. "Yi Syllables": range(40960, 42127 + 1),
  145. "Yi Radicals": range(42128, 42191 + 1),
  146. "Lisu": range(42192, 42239 + 1),
  147. "Vai": range(42240, 42559 + 1),
  148. "Cyrillic Extended-B": range(42560, 42655 + 1),
  149. "Bamum": range(42656, 42751 + 1),
  150. "Modifier Tone Letters": range(42752, 42783 + 1),
  151. "Latin Extended-D": range(42784, 43007 + 1),
  152. "Syloti Nagri": range(43008, 43055 + 1),
  153. "Common Indic Number Forms": range(43056, 43071 + 1),
  154. "Phags-pa": range(43072, 43135 + 1),
  155. "Saurashtra": range(43136, 43231 + 1),
  156. "Devanagari Extended": range(43232, 43263 + 1),
  157. "Kayah Li": range(43264, 43311 + 1),
  158. "Rejang": range(43312, 43359 + 1),
  159. "Hangul Jamo Extended-A": range(43360, 43391 + 1),
  160. "Javanese": range(43392, 43487 + 1),
  161. "Myanmar Extended-B": range(43488, 43519 + 1),
  162. "Cham": range(43520, 43615 + 1),
  163. "Myanmar Extended-A": range(43616, 43647 + 1),
  164. "Tai Viet": range(43648, 43743 + 1),
  165. "Meetei Mayek Extensions": range(43744, 43775 + 1),
  166. "Ethiopic Extended-A": range(43776, 43823 + 1),
  167. "Latin Extended-E": range(43824, 43887 + 1),
  168. "Cherokee Supplement": range(43888, 43967 + 1),
  169. "Meetei Mayek": range(43968, 44031 + 1),
  170. "Hangul Syllables": range(44032, 55215 + 1),
  171. "Hangul Jamo Extended-B": range(55216, 55295 + 1),
  172. "High Surrogates": range(55296, 56191 + 1),
  173. "High Private Use Surrogates": range(56192, 56319 + 1),
  174. "Low Surrogates": range(56320, 57343 + 1),
  175. "Private Use Area": range(57344, 63743 + 1),
  176. "CJK Compatibility Ideographs": range(63744, 64255 + 1),
  177. "Alphabetic Presentation Forms": range(64256, 64335 + 1),
  178. "Arabic Presentation Forms-A": range(64336, 65023 + 1),
  179. "Variation Selectors": range(65024, 65039 + 1),
  180. "Vertical Forms": range(65040, 65055 + 1),
  181. "Combining Half Marks": range(65056, 65071 + 1),
  182. "CJK Compatibility Forms": range(65072, 65103 + 1),
  183. "Small Form Variants": range(65104, 65135 + 1),
  184. "Arabic Presentation Forms-B": range(65136, 65279 + 1),
  185. "Halfwidth and Fullwidth Forms": range(65280, 65519 + 1),
  186. "Specials": range(65520, 65535 + 1),
  187. "Linear B Syllabary": range(65536, 65663 + 1),
  188. "Linear B Ideograms": range(65664, 65791 + 1),
  189. "Aegean Numbers": range(65792, 65855 + 1),
  190. "Ancient Greek Numbers": range(65856, 65935 + 1),
  191. "Ancient Symbols": range(65936, 65999 + 1),
  192. "Phaistos Disc": range(66000, 66047 + 1),
  193. "Lycian": range(66176, 66207 + 1),
  194. "Carian": range(66208, 66271 + 1),
  195. "Coptic Epact Numbers": range(66272, 66303 + 1),
  196. "Old Italic": range(66304, 66351 + 1),
  197. "Gothic": range(66352, 66383 + 1),
  198. "Old Permic": range(66384, 66431 + 1),
  199. "Ugaritic": range(66432, 66463 + 1),
  200. "Old Persian": range(66464, 66527 + 1),
  201. "Deseret": range(66560, 66639 + 1),
  202. "Shavian": range(66640, 66687 + 1),
  203. "Osmanya": range(66688, 66735 + 1),
  204. "Osage": range(66736, 66815 + 1),
  205. "Elbasan": range(66816, 66863 + 1),
  206. "Caucasian Albanian": range(66864, 66927 + 1),
  207. "Linear A": range(67072, 67455 + 1),
  208. "Cypriot Syllabary": range(67584, 67647 + 1),
  209. "Imperial Aramaic": range(67648, 67679 + 1),
  210. "Palmyrene": range(67680, 67711 + 1),
  211. "Nabataean": range(67712, 67759 + 1),
  212. "Hatran": range(67808, 67839 + 1),
  213. "Phoenician": range(67840, 67871 + 1),
  214. "Lydian": range(67872, 67903 + 1),
  215. "Meroitic Hieroglyphs": range(67968, 67999 + 1),
  216. "Meroitic Cursive": range(68000, 68095 + 1),
  217. "Kharoshthi": range(68096, 68191 + 1),
  218. "Old South Arabian": range(68192, 68223 + 1),
  219. "Old North Arabian": range(68224, 68255 + 1),
  220. "Manichaean": range(68288, 68351 + 1),
  221. "Avestan": range(68352, 68415 + 1),
  222. "Inscriptional Parthian": range(68416, 68447 + 1),
  223. "Inscriptional Pahlavi": range(68448, 68479 + 1),
  224. "Psalter Pahlavi": range(68480, 68527 + 1),
  225. "Old Turkic": range(68608, 68687 + 1),
  226. "Old Hungarian": range(68736, 68863 + 1),
  227. "Rumi Numeral Symbols": range(69216, 69247 + 1),
  228. "Brahmi": range(69632, 69759 + 1),
  229. "Kaithi": range(69760, 69839 + 1),
  230. "Sora Sompeng": range(69840, 69887 + 1),
  231. "Chakma": range(69888, 69967 + 1),
  232. "Mahajani": range(69968, 70015 + 1),
  233. "Sharada": range(70016, 70111 + 1),
  234. "Sinhala Archaic Numbers": range(70112, 70143 + 1),
  235. "Khojki": range(70144, 70223 + 1),
  236. "Multani": range(70272, 70319 + 1),
  237. "Khudawadi": range(70320, 70399 + 1),
  238. "Grantha": range(70400, 70527 + 1),
  239. "Newa": range(70656, 70783 + 1),
  240. "Tirhuta": range(70784, 70879 + 1),
  241. "Siddham": range(71040, 71167 + 1),
  242. "Modi": range(71168, 71263 + 1),
  243. "Mongolian Supplement": range(71264, 71295 + 1),
  244. "Takri": range(71296, 71375 + 1),
  245. "Ahom": range(71424, 71487 + 1),
  246. "Warang Citi": range(71840, 71935 + 1),
  247. "Zanabazar Square": range(72192, 72271 + 1),
  248. "Soyombo": range(72272, 72367 + 1),
  249. "Pau Cin Hau": range(72384, 72447 + 1),
  250. "Bhaiksuki": range(72704, 72815 + 1),
  251. "Marchen": range(72816, 72895 + 1),
  252. "Masaram Gondi": range(72960, 73055 + 1),
  253. "Cuneiform": range(73728, 74751 + 1),
  254. "Cuneiform Numbers and Punctuation": range(74752, 74879 + 1),
  255. "Early Dynastic Cuneiform": range(74880, 75087 + 1),
  256. "Egyptian Hieroglyphs": range(77824, 78895 + 1),
  257. "Anatolian Hieroglyphs": range(82944, 83583 + 1),
  258. "Bamum Supplement": range(92160, 92735 + 1),
  259. "Mro": range(92736, 92783 + 1),
  260. "Bassa Vah": range(92880, 92927 + 1),
  261. "Pahawh Hmong": range(92928, 93071 + 1),
  262. "Miao": range(93952, 94111 + 1),
  263. "Ideographic Symbols and Punctuation": range(94176, 94207 + 1),
  264. "Tangut": range(94208, 100351 + 1),
  265. "Tangut Components": range(100352, 101119 + 1),
  266. "Kana Supplement": range(110592, 110847 + 1),
  267. "Kana Extended-A": range(110848, 110895 + 1),
  268. "Nushu": range(110960, 111359 + 1),
  269. "Duployan": range(113664, 113823 + 1),
  270. "Shorthand Format Controls": range(113824, 113839 + 1),
  271. "Byzantine Musical Symbols": range(118784, 119039 + 1),
  272. "Musical Symbols": range(119040, 119295 + 1),
  273. "Ancient Greek Musical Notation": range(119296, 119375 + 1),
  274. "Tai Xuan Jing Symbols": range(119552, 119647 + 1),
  275. "Counting Rod Numerals": range(119648, 119679 + 1),
  276. "Mathematical Alphanumeric Symbols": range(119808, 120831 + 1),
  277. "Sutton SignWriting": range(120832, 121519 + 1),
  278. "Glagolitic Supplement": range(122880, 122927 + 1),
  279. "Mende Kikakui": range(124928, 125151 + 1),
  280. "Adlam": range(125184, 125279 + 1),
  281. "Arabic Mathematical Alphabetic Symbols": range(126464, 126719 + 1),
  282. "Mahjong Tiles": range(126976, 127023 + 1),
  283. "Domino Tiles": range(127024, 127135 + 1),
  284. "Playing Cards": range(127136, 127231 + 1),
  285. "Enclosed Alphanumeric Supplement": range(127232, 127487 + 1),
  286. "Enclosed Ideographic Supplement": range(127488, 127743 + 1),
  287. "Miscellaneous Symbols and Pictographs": range(127744, 128511 + 1),
  288. "Emoticons range(Emoji)": range(128512, 128591 + 1),
  289. "Ornamental Dingbats": range(128592, 128639 + 1),
  290. "Transport and Map Symbols": range(128640, 128767 + 1),
  291. "Alchemical Symbols": range(128768, 128895 + 1),
  292. "Geometric Shapes Extended": range(128896, 129023 + 1),
  293. "Supplemental Arrows-C": range(129024, 129279 + 1),
  294. "Supplemental Symbols and Pictographs": range(129280, 129535 + 1),
  295. "CJK Unified Ideographs Extension B": range(131072, 173791 + 1),
  296. "CJK Unified Ideographs Extension C": range(173824, 177983 + 1),
  297. "CJK Unified Ideographs Extension D": range(177984, 178207 + 1),
  298. "CJK Unified Ideographs Extension E": range(178208, 183983 + 1),
  299. "CJK Unified Ideographs Extension F": range(183984, 191471 + 1),
  300. "CJK Compatibility Ideographs Supplement": range(194560, 195103 + 1),
  301. "Tags": range(917504, 917631 + 1),
  302. "Variation Selectors Supplement": range(917760, 917999 + 1),
  303. }
  304. UNICODE_SECONDARY_RANGE_KEYWORD: List[str] = [
  305. "Supplement",
  306. "Extended",
  307. "Extensions",
  308. "Modifier",
  309. "Marks",
  310. "Punctuation",
  311. "Symbols",
  312. "Forms",
  313. "Operators",
  314. "Miscellaneous",
  315. "Drawing",
  316. "Block",
  317. "Shapes",
  318. "Supplemental",
  319. "Tags",
  320. ]
  321. RE_POSSIBLE_ENCODING_INDICATION = re_compile(
  322. r"(?:(?:encoding)|(?:charset)|(?:coding))(?:[\:= ]{1,10})(?:[\"\']?)([a-zA-Z0-9\-_]+)(?:[\"\']?)",
  323. IGNORECASE,
  324. )
  325. IANA_SUPPORTED: List[str] = sorted(
  326. filter(
  327. lambda x: x.endswith("_codec") is False
  328. and x not in {"rot_13", "tactis", "mbcs"},
  329. list(set(aliases.values())),
  330. )
  331. )
  332. IANA_SUPPORTED_COUNT: int = len(IANA_SUPPORTED)
  333. # pre-computed code page that are similar using the function cp_similarity.
  334. IANA_SUPPORTED_SIMILAR: Dict[str, List[str]] = {
  335. "cp037": ["cp1026", "cp1140", "cp273", "cp500"],
  336. "cp1026": ["cp037", "cp1140", "cp273", "cp500"],
  337. "cp1125": ["cp866"],
  338. "cp1140": ["cp037", "cp1026", "cp273", "cp500"],
  339. "cp1250": ["iso8859_2"],
  340. "cp1251": ["kz1048", "ptcp154"],
  341. "cp1252": ["iso8859_15", "iso8859_9", "latin_1"],
  342. "cp1253": ["iso8859_7"],
  343. "cp1254": ["iso8859_15", "iso8859_9", "latin_1"],
  344. "cp1257": ["iso8859_13"],
  345. "cp273": ["cp037", "cp1026", "cp1140", "cp500"],
  346. "cp437": ["cp850", "cp858", "cp860", "cp861", "cp862", "cp863", "cp865"],
  347. "cp500": ["cp037", "cp1026", "cp1140", "cp273"],
  348. "cp850": ["cp437", "cp857", "cp858", "cp865"],
  349. "cp857": ["cp850", "cp858", "cp865"],
  350. "cp858": ["cp437", "cp850", "cp857", "cp865"],
  351. "cp860": ["cp437", "cp861", "cp862", "cp863", "cp865"],
  352. "cp861": ["cp437", "cp860", "cp862", "cp863", "cp865"],
  353. "cp862": ["cp437", "cp860", "cp861", "cp863", "cp865"],
  354. "cp863": ["cp437", "cp860", "cp861", "cp862", "cp865"],
  355. "cp865": ["cp437", "cp850", "cp857", "cp858", "cp860", "cp861", "cp862", "cp863"],
  356. "cp866": ["cp1125"],
  357. "iso8859_10": ["iso8859_14", "iso8859_15", "iso8859_4", "iso8859_9", "latin_1"],
  358. "iso8859_11": ["tis_620"],
  359. "iso8859_13": ["cp1257"],
  360. "iso8859_14": [
  361. "iso8859_10",
  362. "iso8859_15",
  363. "iso8859_16",
  364. "iso8859_3",
  365. "iso8859_9",
  366. "latin_1",
  367. ],
  368. "iso8859_15": [
  369. "cp1252",
  370. "cp1254",
  371. "iso8859_10",
  372. "iso8859_14",
  373. "iso8859_16",
  374. "iso8859_3",
  375. "iso8859_9",
  376. "latin_1",
  377. ],
  378. "iso8859_16": [
  379. "iso8859_14",
  380. "iso8859_15",
  381. "iso8859_2",
  382. "iso8859_3",
  383. "iso8859_9",
  384. "latin_1",
  385. ],
  386. "iso8859_2": ["cp1250", "iso8859_16", "iso8859_4"],
  387. "iso8859_3": ["iso8859_14", "iso8859_15", "iso8859_16", "iso8859_9", "latin_1"],
  388. "iso8859_4": ["iso8859_10", "iso8859_2", "iso8859_9", "latin_1"],
  389. "iso8859_7": ["cp1253"],
  390. "iso8859_9": [
  391. "cp1252",
  392. "cp1254",
  393. "cp1258",
  394. "iso8859_10",
  395. "iso8859_14",
  396. "iso8859_15",
  397. "iso8859_16",
  398. "iso8859_3",
  399. "iso8859_4",
  400. "latin_1",
  401. ],
  402. "kz1048": ["cp1251", "ptcp154"],
  403. "latin_1": [
  404. "cp1252",
  405. "cp1254",
  406. "cp1258",
  407. "iso8859_10",
  408. "iso8859_14",
  409. "iso8859_15",
  410. "iso8859_16",
  411. "iso8859_3",
  412. "iso8859_4",
  413. "iso8859_9",
  414. ],
  415. "mac_iceland": ["mac_roman", "mac_turkish"],
  416. "mac_roman": ["mac_iceland", "mac_turkish"],
  417. "mac_turkish": ["mac_iceland", "mac_roman"],
  418. "ptcp154": ["cp1251", "kz1048"],
  419. "tis_620": ["iso8859_11"],
  420. }
  421. CHARDET_CORRESPONDENCE: Dict[str, str] = {
  422. "iso2022_kr": "ISO-2022-KR",
  423. "iso2022_jp": "ISO-2022-JP",
  424. "euc_kr": "EUC-KR",
  425. "tis_620": "TIS-620",
  426. "utf_32": "UTF-32",
  427. "euc_jp": "EUC-JP",
  428. "koi8_r": "KOI8-R",
  429. "iso8859_1": "ISO-8859-1",
  430. "iso8859_2": "ISO-8859-2",
  431. "iso8859_5": "ISO-8859-5",
  432. "iso8859_6": "ISO-8859-6",
  433. "iso8859_7": "ISO-8859-7",
  434. "iso8859_8": "ISO-8859-8",
  435. "utf_16": "UTF-16",
  436. "cp855": "IBM855",
  437. "mac_cyrillic": "MacCyrillic",
  438. "gb2312": "GB2312",
  439. "gb18030": "GB18030",
  440. "cp932": "CP932",
  441. "cp866": "IBM866",
  442. "utf_8": "utf-8",
  443. "utf_8_sig": "UTF-8-SIG",
  444. "shift_jis": "SHIFT_JIS",
  445. "big5": "Big5",
  446. "cp1250": "windows-1250",
  447. "cp1251": "windows-1251",
  448. "cp1252": "Windows-1252",
  449. "cp1253": "windows-1253",
  450. "cp1255": "windows-1255",
  451. "cp1256": "windows-1256",
  452. "cp1254": "Windows-1254",
  453. "cp949": "CP949",
  454. }
  455. COMMON_SAFE_ASCII_CHARACTERS: Set[str] = {
  456. "<",
  457. ">",
  458. "=",
  459. ":",
  460. "/",
  461. "&",
  462. ";",
  463. "{",
  464. "}",
  465. "[",
  466. "]",
  467. ",",
  468. "|",
  469. '"',
  470. "-",
  471. }
  472. KO_NAMES: Set[str] = {"johab", "cp949", "euc_kr"}
  473. ZH_NAMES: Set[str] = {"big5", "cp950", "big5hkscs", "hz"}
  474. LANGUAGE_SUPPORTED_COUNT: int = len(FREQUENCIES)
  475. # Logging LEVEL below DEBUG
  476. TRACE: int = 5