]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/compat.py
debian/control: State compliancy with policy 4.5.0 (no further changes needed).
[youtubedl] / youtube_dl / compat.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 import base64
5 import binascii
6 import collections
7 import ctypes
8 import email
9 import getpass
10 import io
11 import itertools
12 import optparse
13 import os
14 import platform
15 import re
16 import shlex
17 import shutil
18 import socket
19 import struct
20 import subprocess
21 import sys
22 import xml.etree.ElementTree
23
24
25 try:
26 import urllib.request as compat_urllib_request
27 except ImportError: # Python 2
28 import urllib2 as compat_urllib_request
29
30 try:
31 import urllib.error as compat_urllib_error
32 except ImportError: # Python 2
33 import urllib2 as compat_urllib_error
34
35 try:
36 import urllib.parse as compat_urllib_parse
37 except ImportError: # Python 2
38 import urllib as compat_urllib_parse
39
40 try:
41 from urllib.parse import urlparse as compat_urllib_parse_urlparse
42 except ImportError: # Python 2
43 from urlparse import urlparse as compat_urllib_parse_urlparse
44
45 try:
46 import urllib.parse as compat_urlparse
47 except ImportError: # Python 2
48 import urlparse as compat_urlparse
49
50 try:
51 import urllib.response as compat_urllib_response
52 except ImportError: # Python 2
53 import urllib as compat_urllib_response
54
55 try:
56 import http.cookiejar as compat_cookiejar
57 except ImportError: # Python 2
58 import cookielib as compat_cookiejar
59
60 try:
61 import http.cookies as compat_cookies
62 except ImportError: # Python 2
63 import Cookie as compat_cookies
64
65 try:
66 import html.entities as compat_html_entities
67 except ImportError: # Python 2
68 import htmlentitydefs as compat_html_entities
69
70 try: # Python >= 3.3
71 compat_html_entities_html5 = compat_html_entities.html5
72 except AttributeError:
73 # Copied from CPython 3.5.1 html/entities.py
74 compat_html_entities_html5 = {
75 'Aacute': '\xc1',
76 'aacute': '\xe1',
77 'Aacute;': '\xc1',
78 'aacute;': '\xe1',
79 'Abreve;': '\u0102',
80 'abreve;': '\u0103',
81 'ac;': '\u223e',
82 'acd;': '\u223f',
83 'acE;': '\u223e\u0333',
84 'Acirc': '\xc2',
85 'acirc': '\xe2',
86 'Acirc;': '\xc2',
87 'acirc;': '\xe2',
88 'acute': '\xb4',
89 'acute;': '\xb4',
90 'Acy;': '\u0410',
91 'acy;': '\u0430',
92 'AElig': '\xc6',
93 'aelig': '\xe6',
94 'AElig;': '\xc6',
95 'aelig;': '\xe6',
96 'af;': '\u2061',
97 'Afr;': '\U0001d504',
98 'afr;': '\U0001d51e',
99 'Agrave': '\xc0',
100 'agrave': '\xe0',
101 'Agrave;': '\xc0',
102 'agrave;': '\xe0',
103 'alefsym;': '\u2135',
104 'aleph;': '\u2135',
105 'Alpha;': '\u0391',
106 'alpha;': '\u03b1',
107 'Amacr;': '\u0100',
108 'amacr;': '\u0101',
109 'amalg;': '\u2a3f',
110 'AMP': '&',
111 'amp': '&',
112 'AMP;': '&',
113 'amp;': '&',
114 'And;': '\u2a53',
115 'and;': '\u2227',
116 'andand;': '\u2a55',
117 'andd;': '\u2a5c',
118 'andslope;': '\u2a58',
119 'andv;': '\u2a5a',
120 'ang;': '\u2220',
121 'ange;': '\u29a4',
122 'angle;': '\u2220',
123 'angmsd;': '\u2221',
124 'angmsdaa;': '\u29a8',
125 'angmsdab;': '\u29a9',
126 'angmsdac;': '\u29aa',
127 'angmsdad;': '\u29ab',
128 'angmsdae;': '\u29ac',
129 'angmsdaf;': '\u29ad',
130 'angmsdag;': '\u29ae',
131 'angmsdah;': '\u29af',
132 'angrt;': '\u221f',
133 'angrtvb;': '\u22be',
134 'angrtvbd;': '\u299d',
135 'angsph;': '\u2222',
136 'angst;': '\xc5',
137 'angzarr;': '\u237c',
138 'Aogon;': '\u0104',
139 'aogon;': '\u0105',
140 'Aopf;': '\U0001d538',
141 'aopf;': '\U0001d552',
142 'ap;': '\u2248',
143 'apacir;': '\u2a6f',
144 'apE;': '\u2a70',
145 'ape;': '\u224a',
146 'apid;': '\u224b',
147 'apos;': "'",
148 'ApplyFunction;': '\u2061',
149 'approx;': '\u2248',
150 'approxeq;': '\u224a',
151 'Aring': '\xc5',
152 'aring': '\xe5',
153 'Aring;': '\xc5',
154 'aring;': '\xe5',
155 'Ascr;': '\U0001d49c',
156 'ascr;': '\U0001d4b6',
157 'Assign;': '\u2254',
158 'ast;': '*',
159 'asymp;': '\u2248',
160 'asympeq;': '\u224d',
161 'Atilde': '\xc3',
162 'atilde': '\xe3',
163 'Atilde;': '\xc3',
164 'atilde;': '\xe3',
165 'Auml': '\xc4',
166 'auml': '\xe4',
167 'Auml;': '\xc4',
168 'auml;': '\xe4',
169 'awconint;': '\u2233',
170 'awint;': '\u2a11',
171 'backcong;': '\u224c',
172 'backepsilon;': '\u03f6',
173 'backprime;': '\u2035',
174 'backsim;': '\u223d',
175 'backsimeq;': '\u22cd',
176 'Backslash;': '\u2216',
177 'Barv;': '\u2ae7',
178 'barvee;': '\u22bd',
179 'Barwed;': '\u2306',
180 'barwed;': '\u2305',
181 'barwedge;': '\u2305',
182 'bbrk;': '\u23b5',
183 'bbrktbrk;': '\u23b6',
184 'bcong;': '\u224c',
185 'Bcy;': '\u0411',
186 'bcy;': '\u0431',
187 'bdquo;': '\u201e',
188 'becaus;': '\u2235',
189 'Because;': '\u2235',
190 'because;': '\u2235',
191 'bemptyv;': '\u29b0',
192 'bepsi;': '\u03f6',
193 'bernou;': '\u212c',
194 'Bernoullis;': '\u212c',
195 'Beta;': '\u0392',
196 'beta;': '\u03b2',
197 'beth;': '\u2136',
198 'between;': '\u226c',
199 'Bfr;': '\U0001d505',
200 'bfr;': '\U0001d51f',
201 'bigcap;': '\u22c2',
202 'bigcirc;': '\u25ef',
203 'bigcup;': '\u22c3',
204 'bigodot;': '\u2a00',
205 'bigoplus;': '\u2a01',
206 'bigotimes;': '\u2a02',
207 'bigsqcup;': '\u2a06',
208 'bigstar;': '\u2605',
209 'bigtriangledown;': '\u25bd',
210 'bigtriangleup;': '\u25b3',
211 'biguplus;': '\u2a04',
212 'bigvee;': '\u22c1',
213 'bigwedge;': '\u22c0',
214 'bkarow;': '\u290d',
215 'blacklozenge;': '\u29eb',
216 'blacksquare;': '\u25aa',
217 'blacktriangle;': '\u25b4',
218 'blacktriangledown;': '\u25be',
219 'blacktriangleleft;': '\u25c2',
220 'blacktriangleright;': '\u25b8',
221 'blank;': '\u2423',
222 'blk12;': '\u2592',
223 'blk14;': '\u2591',
224 'blk34;': '\u2593',
225 'block;': '\u2588',
226 'bne;': '=\u20e5',
227 'bnequiv;': '\u2261\u20e5',
228 'bNot;': '\u2aed',
229 'bnot;': '\u2310',
230 'Bopf;': '\U0001d539',
231 'bopf;': '\U0001d553',
232 'bot;': '\u22a5',
233 'bottom;': '\u22a5',
234 'bowtie;': '\u22c8',
235 'boxbox;': '\u29c9',
236 'boxDL;': '\u2557',
237 'boxDl;': '\u2556',
238 'boxdL;': '\u2555',
239 'boxdl;': '\u2510',
240 'boxDR;': '\u2554',
241 'boxDr;': '\u2553',
242 'boxdR;': '\u2552',
243 'boxdr;': '\u250c',
244 'boxH;': '\u2550',
245 'boxh;': '\u2500',
246 'boxHD;': '\u2566',
247 'boxHd;': '\u2564',
248 'boxhD;': '\u2565',
249 'boxhd;': '\u252c',
250 'boxHU;': '\u2569',
251 'boxHu;': '\u2567',
252 'boxhU;': '\u2568',
253 'boxhu;': '\u2534',
254 'boxminus;': '\u229f',
255 'boxplus;': '\u229e',
256 'boxtimes;': '\u22a0',
257 'boxUL;': '\u255d',
258 'boxUl;': '\u255c',
259 'boxuL;': '\u255b',
260 'boxul;': '\u2518',
261 'boxUR;': '\u255a',
262 'boxUr;': '\u2559',
263 'boxuR;': '\u2558',
264 'boxur;': '\u2514',
265 'boxV;': '\u2551',
266 'boxv;': '\u2502',
267 'boxVH;': '\u256c',
268 'boxVh;': '\u256b',
269 'boxvH;': '\u256a',
270 'boxvh;': '\u253c',
271 'boxVL;': '\u2563',
272 'boxVl;': '\u2562',
273 'boxvL;': '\u2561',
274 'boxvl;': '\u2524',
275 'boxVR;': '\u2560',
276 'boxVr;': '\u255f',
277 'boxvR;': '\u255e',
278 'boxvr;': '\u251c',
279 'bprime;': '\u2035',
280 'Breve;': '\u02d8',
281 'breve;': '\u02d8',
282 'brvbar': '\xa6',
283 'brvbar;': '\xa6',
284 'Bscr;': '\u212c',
285 'bscr;': '\U0001d4b7',
286 'bsemi;': '\u204f',
287 'bsim;': '\u223d',
288 'bsime;': '\u22cd',
289 'bsol;': '\\',
290 'bsolb;': '\u29c5',
291 'bsolhsub;': '\u27c8',
292 'bull;': '\u2022',
293 'bullet;': '\u2022',
294 'bump;': '\u224e',
295 'bumpE;': '\u2aae',
296 'bumpe;': '\u224f',
297 'Bumpeq;': '\u224e',
298 'bumpeq;': '\u224f',
299 'Cacute;': '\u0106',
300 'cacute;': '\u0107',
301 'Cap;': '\u22d2',
302 'cap;': '\u2229',
303 'capand;': '\u2a44',
304 'capbrcup;': '\u2a49',
305 'capcap;': '\u2a4b',
306 'capcup;': '\u2a47',
307 'capdot;': '\u2a40',
308 'CapitalDifferentialD;': '\u2145',
309 'caps;': '\u2229\ufe00',
310 'caret;': '\u2041',
311 'caron;': '\u02c7',
312 'Cayleys;': '\u212d',
313 'ccaps;': '\u2a4d',
314 'Ccaron;': '\u010c',
315 'ccaron;': '\u010d',
316 'Ccedil': '\xc7',
317 'ccedil': '\xe7',
318 'Ccedil;': '\xc7',
319 'ccedil;': '\xe7',
320 'Ccirc;': '\u0108',
321 'ccirc;': '\u0109',
322 'Cconint;': '\u2230',
323 'ccups;': '\u2a4c',
324 'ccupssm;': '\u2a50',
325 'Cdot;': '\u010a',
326 'cdot;': '\u010b',
327 'cedil': '\xb8',
328 'cedil;': '\xb8',
329 'Cedilla;': '\xb8',
330 'cemptyv;': '\u29b2',
331 'cent': '\xa2',
332 'cent;': '\xa2',
333 'CenterDot;': '\xb7',
334 'centerdot;': '\xb7',
335 'Cfr;': '\u212d',
336 'cfr;': '\U0001d520',
337 'CHcy;': '\u0427',
338 'chcy;': '\u0447',
339 'check;': '\u2713',
340 'checkmark;': '\u2713',
341 'Chi;': '\u03a7',
342 'chi;': '\u03c7',
343 'cir;': '\u25cb',
344 'circ;': '\u02c6',
345 'circeq;': '\u2257',
346 'circlearrowleft;': '\u21ba',
347 'circlearrowright;': '\u21bb',
348 'circledast;': '\u229b',
349 'circledcirc;': '\u229a',
350 'circleddash;': '\u229d',
351 'CircleDot;': '\u2299',
352 'circledR;': '\xae',
353 'circledS;': '\u24c8',
354 'CircleMinus;': '\u2296',
355 'CirclePlus;': '\u2295',
356 'CircleTimes;': '\u2297',
357 'cirE;': '\u29c3',
358 'cire;': '\u2257',
359 'cirfnint;': '\u2a10',
360 'cirmid;': '\u2aef',
361 'cirscir;': '\u29c2',
362 'ClockwiseContourIntegral;': '\u2232',
363 'CloseCurlyDoubleQuote;': '\u201d',
364 'CloseCurlyQuote;': '\u2019',
365 'clubs;': '\u2663',
366 'clubsuit;': '\u2663',
367 'Colon;': '\u2237',
368 'colon;': ':',
369 'Colone;': '\u2a74',
370 'colone;': '\u2254',
371 'coloneq;': '\u2254',
372 'comma;': ',',
373 'commat;': '@',
374 'comp;': '\u2201',
375 'compfn;': '\u2218',
376 'complement;': '\u2201',
377 'complexes;': '\u2102',
378 'cong;': '\u2245',
379 'congdot;': '\u2a6d',
380 'Congruent;': '\u2261',
381 'Conint;': '\u222f',
382 'conint;': '\u222e',
383 'ContourIntegral;': '\u222e',
384 'Copf;': '\u2102',
385 'copf;': '\U0001d554',
386 'coprod;': '\u2210',
387 'Coproduct;': '\u2210',
388 'COPY': '\xa9',
389 'copy': '\xa9',
390 'COPY;': '\xa9',
391 'copy;': '\xa9',
392 'copysr;': '\u2117',
393 'CounterClockwiseContourIntegral;': '\u2233',
394 'crarr;': '\u21b5',
395 'Cross;': '\u2a2f',
396 'cross;': '\u2717',
397 'Cscr;': '\U0001d49e',
398 'cscr;': '\U0001d4b8',
399 'csub;': '\u2acf',
400 'csube;': '\u2ad1',
401 'csup;': '\u2ad0',
402 'csupe;': '\u2ad2',
403 'ctdot;': '\u22ef',
404 'cudarrl;': '\u2938',
405 'cudarrr;': '\u2935',
406 'cuepr;': '\u22de',
407 'cuesc;': '\u22df',
408 'cularr;': '\u21b6',
409 'cularrp;': '\u293d',
410 'Cup;': '\u22d3',
411 'cup;': '\u222a',
412 'cupbrcap;': '\u2a48',
413 'CupCap;': '\u224d',
414 'cupcap;': '\u2a46',
415 'cupcup;': '\u2a4a',
416 'cupdot;': '\u228d',
417 'cupor;': '\u2a45',
418 'cups;': '\u222a\ufe00',
419 'curarr;': '\u21b7',
420 'curarrm;': '\u293c',
421 'curlyeqprec;': '\u22de',
422 'curlyeqsucc;': '\u22df',
423 'curlyvee;': '\u22ce',
424 'curlywedge;': '\u22cf',
425 'curren': '\xa4',
426 'curren;': '\xa4',
427 'curvearrowleft;': '\u21b6',
428 'curvearrowright;': '\u21b7',
429 'cuvee;': '\u22ce',
430 'cuwed;': '\u22cf',
431 'cwconint;': '\u2232',
432 'cwint;': '\u2231',
433 'cylcty;': '\u232d',
434 'Dagger;': '\u2021',
435 'dagger;': '\u2020',
436 'daleth;': '\u2138',
437 'Darr;': '\u21a1',
438 'dArr;': '\u21d3',
439 'darr;': '\u2193',
440 'dash;': '\u2010',
441 'Dashv;': '\u2ae4',
442 'dashv;': '\u22a3',
443 'dbkarow;': '\u290f',
444 'dblac;': '\u02dd',
445 'Dcaron;': '\u010e',
446 'dcaron;': '\u010f',
447 'Dcy;': '\u0414',
448 'dcy;': '\u0434',
449 'DD;': '\u2145',
450 'dd;': '\u2146',
451 'ddagger;': '\u2021',
452 'ddarr;': '\u21ca',
453 'DDotrahd;': '\u2911',
454 'ddotseq;': '\u2a77',
455 'deg': '\xb0',
456 'deg;': '\xb0',
457 'Del;': '\u2207',
458 'Delta;': '\u0394',
459 'delta;': '\u03b4',
460 'demptyv;': '\u29b1',
461 'dfisht;': '\u297f',
462 'Dfr;': '\U0001d507',
463 'dfr;': '\U0001d521',
464 'dHar;': '\u2965',
465 'dharl;': '\u21c3',
466 'dharr;': '\u21c2',
467 'DiacriticalAcute;': '\xb4',
468 'DiacriticalDot;': '\u02d9',
469 'DiacriticalDoubleAcute;': '\u02dd',
470 'DiacriticalGrave;': '`',
471 'DiacriticalTilde;': '\u02dc',
472 'diam;': '\u22c4',
473 'Diamond;': '\u22c4',
474 'diamond;': '\u22c4',
475 'diamondsuit;': '\u2666',
476 'diams;': '\u2666',
477 'die;': '\xa8',
478 'DifferentialD;': '\u2146',
479 'digamma;': '\u03dd',
480 'disin;': '\u22f2',
481 'div;': '\xf7',
482 'divide': '\xf7',
483 'divide;': '\xf7',
484 'divideontimes;': '\u22c7',
485 'divonx;': '\u22c7',
486 'DJcy;': '\u0402',
487 'djcy;': '\u0452',
488 'dlcorn;': '\u231e',
489 'dlcrop;': '\u230d',
490 'dollar;': '$',
491 'Dopf;': '\U0001d53b',
492 'dopf;': '\U0001d555',
493 'Dot;': '\xa8',
494 'dot;': '\u02d9',
495 'DotDot;': '\u20dc',
496 'doteq;': '\u2250',
497 'doteqdot;': '\u2251',
498 'DotEqual;': '\u2250',
499 'dotminus;': '\u2238',
500 'dotplus;': '\u2214',
501 'dotsquare;': '\u22a1',
502 'doublebarwedge;': '\u2306',
503 'DoubleContourIntegral;': '\u222f',
504 'DoubleDot;': '\xa8',
505 'DoubleDownArrow;': '\u21d3',
506 'DoubleLeftArrow;': '\u21d0',
507 'DoubleLeftRightArrow;': '\u21d4',
508 'DoubleLeftTee;': '\u2ae4',
509 'DoubleLongLeftArrow;': '\u27f8',
510 'DoubleLongLeftRightArrow;': '\u27fa',
511 'DoubleLongRightArrow;': '\u27f9',
512 'DoubleRightArrow;': '\u21d2',
513 'DoubleRightTee;': '\u22a8',
514 'DoubleUpArrow;': '\u21d1',
515 'DoubleUpDownArrow;': '\u21d5',
516 'DoubleVerticalBar;': '\u2225',
517 'DownArrow;': '\u2193',
518 'Downarrow;': '\u21d3',
519 'downarrow;': '\u2193',
520 'DownArrowBar;': '\u2913',
521 'DownArrowUpArrow;': '\u21f5',
522 'DownBreve;': '\u0311',
523 'downdownarrows;': '\u21ca',
524 'downharpoonleft;': '\u21c3',
525 'downharpoonright;': '\u21c2',
526 'DownLeftRightVector;': '\u2950',
527 'DownLeftTeeVector;': '\u295e',
528 'DownLeftVector;': '\u21bd',
529 'DownLeftVectorBar;': '\u2956',
530 'DownRightTeeVector;': '\u295f',
531 'DownRightVector;': '\u21c1',
532 'DownRightVectorBar;': '\u2957',
533 'DownTee;': '\u22a4',
534 'DownTeeArrow;': '\u21a7',
535 'drbkarow;': '\u2910',
536 'drcorn;': '\u231f',
537 'drcrop;': '\u230c',
538 'Dscr;': '\U0001d49f',
539 'dscr;': '\U0001d4b9',
540 'DScy;': '\u0405',
541 'dscy;': '\u0455',
542 'dsol;': '\u29f6',
543 'Dstrok;': '\u0110',
544 'dstrok;': '\u0111',
545 'dtdot;': '\u22f1',
546 'dtri;': '\u25bf',
547 'dtrif;': '\u25be',
548 'duarr;': '\u21f5',
549 'duhar;': '\u296f',
550 'dwangle;': '\u29a6',
551 'DZcy;': '\u040f',
552 'dzcy;': '\u045f',
553 'dzigrarr;': '\u27ff',
554 'Eacute': '\xc9',
555 'eacute': '\xe9',
556 'Eacute;': '\xc9',
557 'eacute;': '\xe9',
558 'easter;': '\u2a6e',
559 'Ecaron;': '\u011a',
560 'ecaron;': '\u011b',
561 'ecir;': '\u2256',
562 'Ecirc': '\xca',
563 'ecirc': '\xea',
564 'Ecirc;': '\xca',
565 'ecirc;': '\xea',
566 'ecolon;': '\u2255',
567 'Ecy;': '\u042d',
568 'ecy;': '\u044d',
569 'eDDot;': '\u2a77',
570 'Edot;': '\u0116',
571 'eDot;': '\u2251',
572 'edot;': '\u0117',
573 'ee;': '\u2147',
574 'efDot;': '\u2252',
575 'Efr;': '\U0001d508',
576 'efr;': '\U0001d522',
577 'eg;': '\u2a9a',
578 'Egrave': '\xc8',
579 'egrave': '\xe8',
580 'Egrave;': '\xc8',
581 'egrave;': '\xe8',
582 'egs;': '\u2a96',
583 'egsdot;': '\u2a98',
584 'el;': '\u2a99',
585 'Element;': '\u2208',
586 'elinters;': '\u23e7',
587 'ell;': '\u2113',
588 'els;': '\u2a95',
589 'elsdot;': '\u2a97',
590 'Emacr;': '\u0112',
591 'emacr;': '\u0113',
592 'empty;': '\u2205',
593 'emptyset;': '\u2205',
594 'EmptySmallSquare;': '\u25fb',
595 'emptyv;': '\u2205',
596 'EmptyVerySmallSquare;': '\u25ab',
597 'emsp13;': '\u2004',
598 'emsp14;': '\u2005',
599 'emsp;': '\u2003',
600 'ENG;': '\u014a',
601 'eng;': '\u014b',
602 'ensp;': '\u2002',
603 'Eogon;': '\u0118',
604 'eogon;': '\u0119',
605 'Eopf;': '\U0001d53c',
606 'eopf;': '\U0001d556',
607 'epar;': '\u22d5',
608 'eparsl;': '\u29e3',
609 'eplus;': '\u2a71',
610 'epsi;': '\u03b5',
611 'Epsilon;': '\u0395',
612 'epsilon;': '\u03b5',
613 'epsiv;': '\u03f5',
614 'eqcirc;': '\u2256',
615 'eqcolon;': '\u2255',
616 'eqsim;': '\u2242',
617 'eqslantgtr;': '\u2a96',
618 'eqslantless;': '\u2a95',
619 'Equal;': '\u2a75',
620 'equals;': '=',
621 'EqualTilde;': '\u2242',
622 'equest;': '\u225f',
623 'Equilibrium;': '\u21cc',
624 'equiv;': '\u2261',
625 'equivDD;': '\u2a78',
626 'eqvparsl;': '\u29e5',
627 'erarr;': '\u2971',
628 'erDot;': '\u2253',
629 'Escr;': '\u2130',
630 'escr;': '\u212f',
631 'esdot;': '\u2250',
632 'Esim;': '\u2a73',
633 'esim;': '\u2242',
634 'Eta;': '\u0397',
635 'eta;': '\u03b7',
636 'ETH': '\xd0',
637 'eth': '\xf0',
638 'ETH;': '\xd0',
639 'eth;': '\xf0',
640 'Euml': '\xcb',
641 'euml': '\xeb',
642 'Euml;': '\xcb',
643 'euml;': '\xeb',
644 'euro;': '\u20ac',
645 'excl;': '!',
646 'exist;': '\u2203',
647 'Exists;': '\u2203',
648 'expectation;': '\u2130',
649 'ExponentialE;': '\u2147',
650 'exponentiale;': '\u2147',
651 'fallingdotseq;': '\u2252',
652 'Fcy;': '\u0424',
653 'fcy;': '\u0444',
654 'female;': '\u2640',
655 'ffilig;': '\ufb03',
656 'fflig;': '\ufb00',
657 'ffllig;': '\ufb04',
658 'Ffr;': '\U0001d509',
659 'ffr;': '\U0001d523',
660 'filig;': '\ufb01',
661 'FilledSmallSquare;': '\u25fc',
662 'FilledVerySmallSquare;': '\u25aa',
663 'fjlig;': 'fj',
664 'flat;': '\u266d',
665 'fllig;': '\ufb02',
666 'fltns;': '\u25b1',
667 'fnof;': '\u0192',
668 'Fopf;': '\U0001d53d',
669 'fopf;': '\U0001d557',
670 'ForAll;': '\u2200',
671 'forall;': '\u2200',
672 'fork;': '\u22d4',
673 'forkv;': '\u2ad9',
674 'Fouriertrf;': '\u2131',
675 'fpartint;': '\u2a0d',
676 'frac12': '\xbd',
677 'frac12;': '\xbd',
678 'frac13;': '\u2153',
679 'frac14': '\xbc',
680 'frac14;': '\xbc',
681 'frac15;': '\u2155',
682 'frac16;': '\u2159',
683 'frac18;': '\u215b',
684 'frac23;': '\u2154',
685 'frac25;': '\u2156',
686 'frac34': '\xbe',
687 'frac34;': '\xbe',
688 'frac35;': '\u2157',
689 'frac38;': '\u215c',
690 'frac45;': '\u2158',
691 'frac56;': '\u215a',
692 'frac58;': '\u215d',
693 'frac78;': '\u215e',
694 'frasl;': '\u2044',
695 'frown;': '\u2322',
696 'Fscr;': '\u2131',
697 'fscr;': '\U0001d4bb',
698 'gacute;': '\u01f5',
699 'Gamma;': '\u0393',
700 'gamma;': '\u03b3',
701 'Gammad;': '\u03dc',
702 'gammad;': '\u03dd',
703 'gap;': '\u2a86',
704 'Gbreve;': '\u011e',
705 'gbreve;': '\u011f',
706 'Gcedil;': '\u0122',
707 'Gcirc;': '\u011c',
708 'gcirc;': '\u011d',
709 'Gcy;': '\u0413',
710 'gcy;': '\u0433',
711 'Gdot;': '\u0120',
712 'gdot;': '\u0121',
713 'gE;': '\u2267',
714 'ge;': '\u2265',
715 'gEl;': '\u2a8c',
716 'gel;': '\u22db',
717 'geq;': '\u2265',
718 'geqq;': '\u2267',
719 'geqslant;': '\u2a7e',
720 'ges;': '\u2a7e',
721 'gescc;': '\u2aa9',
722 'gesdot;': '\u2a80',
723 'gesdoto;': '\u2a82',
724 'gesdotol;': '\u2a84',
725 'gesl;': '\u22db\ufe00',
726 'gesles;': '\u2a94',
727 'Gfr;': '\U0001d50a',
728 'gfr;': '\U0001d524',
729 'Gg;': '\u22d9',
730 'gg;': '\u226b',
731 'ggg;': '\u22d9',
732 'gimel;': '\u2137',
733 'GJcy;': '\u0403',
734 'gjcy;': '\u0453',
735 'gl;': '\u2277',
736 'gla;': '\u2aa5',
737 'glE;': '\u2a92',
738 'glj;': '\u2aa4',
739 'gnap;': '\u2a8a',
740 'gnapprox;': '\u2a8a',
741 'gnE;': '\u2269',
742 'gne;': '\u2a88',
743 'gneq;': '\u2a88',
744 'gneqq;': '\u2269',
745 'gnsim;': '\u22e7',
746 'Gopf;': '\U0001d53e',
747 'gopf;': '\U0001d558',
748 'grave;': '`',
749 'GreaterEqual;': '\u2265',
750 'GreaterEqualLess;': '\u22db',
751 'GreaterFullEqual;': '\u2267',
752 'GreaterGreater;': '\u2aa2',
753 'GreaterLess;': '\u2277',
754 'GreaterSlantEqual;': '\u2a7e',
755 'GreaterTilde;': '\u2273',
756 'Gscr;': '\U0001d4a2',
757 'gscr;': '\u210a',
758 'gsim;': '\u2273',
759 'gsime;': '\u2a8e',
760 'gsiml;': '\u2a90',
761 'GT': '>',
762 'gt': '>',
763 'GT;': '>',
764 'Gt;': '\u226b',
765 'gt;': '>',
766 'gtcc;': '\u2aa7',
767 'gtcir;': '\u2a7a',
768 'gtdot;': '\u22d7',
769 'gtlPar;': '\u2995',
770 'gtquest;': '\u2a7c',
771 'gtrapprox;': '\u2a86',
772 'gtrarr;': '\u2978',
773 'gtrdot;': '\u22d7',
774 'gtreqless;': '\u22db',
775 'gtreqqless;': '\u2a8c',
776 'gtrless;': '\u2277',
777 'gtrsim;': '\u2273',
778 'gvertneqq;': '\u2269\ufe00',
779 'gvnE;': '\u2269\ufe00',
780 'Hacek;': '\u02c7',
781 'hairsp;': '\u200a',
782 'half;': '\xbd',
783 'hamilt;': '\u210b',
784 'HARDcy;': '\u042a',
785 'hardcy;': '\u044a',
786 'hArr;': '\u21d4',
787 'harr;': '\u2194',
788 'harrcir;': '\u2948',
789 'harrw;': '\u21ad',
790 'Hat;': '^',
791 'hbar;': '\u210f',
792 'Hcirc;': '\u0124',
793 'hcirc;': '\u0125',
794 'hearts;': '\u2665',
795 'heartsuit;': '\u2665',
796 'hellip;': '\u2026',
797 'hercon;': '\u22b9',
798 'Hfr;': '\u210c',
799 'hfr;': '\U0001d525',
800 'HilbertSpace;': '\u210b',
801 'hksearow;': '\u2925',
802 'hkswarow;': '\u2926',
803 'hoarr;': '\u21ff',
804 'homtht;': '\u223b',
805 'hookleftarrow;': '\u21a9',
806 'hookrightarrow;': '\u21aa',
807 'Hopf;': '\u210d',
808 'hopf;': '\U0001d559',
809 'horbar;': '\u2015',
810 'HorizontalLine;': '\u2500',
811 'Hscr;': '\u210b',
812 'hscr;': '\U0001d4bd',
813 'hslash;': '\u210f',
814 'Hstrok;': '\u0126',
815 'hstrok;': '\u0127',
816 'HumpDownHump;': '\u224e',
817 'HumpEqual;': '\u224f',
818 'hybull;': '\u2043',
819 'hyphen;': '\u2010',
820 'Iacute': '\xcd',
821 'iacute': '\xed',
822 'Iacute;': '\xcd',
823 'iacute;': '\xed',
824 'ic;': '\u2063',
825 'Icirc': '\xce',
826 'icirc': '\xee',
827 'Icirc;': '\xce',
828 'icirc;': '\xee',
829 'Icy;': '\u0418',
830 'icy;': '\u0438',
831 'Idot;': '\u0130',
832 'IEcy;': '\u0415',
833 'iecy;': '\u0435',
834 'iexcl': '\xa1',
835 'iexcl;': '\xa1',
836 'iff;': '\u21d4',
837 'Ifr;': '\u2111',
838 'ifr;': '\U0001d526',
839 'Igrave': '\xcc',
840 'igrave': '\xec',
841 'Igrave;': '\xcc',
842 'igrave;': '\xec',
843 'ii;': '\u2148',
844 'iiiint;': '\u2a0c',
845 'iiint;': '\u222d',
846 'iinfin;': '\u29dc',
847 'iiota;': '\u2129',
848 'IJlig;': '\u0132',
849 'ijlig;': '\u0133',
850 'Im;': '\u2111',
851 'Imacr;': '\u012a',
852 'imacr;': '\u012b',
853 'image;': '\u2111',
854 'ImaginaryI;': '\u2148',
855 'imagline;': '\u2110',
856 'imagpart;': '\u2111',
857 'imath;': '\u0131',
858 'imof;': '\u22b7',
859 'imped;': '\u01b5',
860 'Implies;': '\u21d2',
861 'in;': '\u2208',
862 'incare;': '\u2105',
863 'infin;': '\u221e',
864 'infintie;': '\u29dd',
865 'inodot;': '\u0131',
866 'Int;': '\u222c',
867 'int;': '\u222b',
868 'intcal;': '\u22ba',
869 'integers;': '\u2124',
870 'Integral;': '\u222b',
871 'intercal;': '\u22ba',
872 'Intersection;': '\u22c2',
873 'intlarhk;': '\u2a17',
874 'intprod;': '\u2a3c',
875 'InvisibleComma;': '\u2063',
876 'InvisibleTimes;': '\u2062',
877 'IOcy;': '\u0401',
878 'iocy;': '\u0451',
879 'Iogon;': '\u012e',
880 'iogon;': '\u012f',
881 'Iopf;': '\U0001d540',
882 'iopf;': '\U0001d55a',
883 'Iota;': '\u0399',
884 'iota;': '\u03b9',
885 'iprod;': '\u2a3c',
886 'iquest': '\xbf',
887 'iquest;': '\xbf',
888 'Iscr;': '\u2110',
889 'iscr;': '\U0001d4be',
890 'isin;': '\u2208',
891 'isindot;': '\u22f5',
892 'isinE;': '\u22f9',
893 'isins;': '\u22f4',
894 'isinsv;': '\u22f3',
895 'isinv;': '\u2208',
896 'it;': '\u2062',
897 'Itilde;': '\u0128',
898 'itilde;': '\u0129',
899 'Iukcy;': '\u0406',
900 'iukcy;': '\u0456',
901 'Iuml': '\xcf',
902 'iuml': '\xef',
903 'Iuml;': '\xcf',
904 'iuml;': '\xef',
905 'Jcirc;': '\u0134',
906 'jcirc;': '\u0135',
907 'Jcy;': '\u0419',
908 'jcy;': '\u0439',
909 'Jfr;': '\U0001d50d',
910 'jfr;': '\U0001d527',
911 'jmath;': '\u0237',
912 'Jopf;': '\U0001d541',
913 'jopf;': '\U0001d55b',
914 'Jscr;': '\U0001d4a5',
915 'jscr;': '\U0001d4bf',
916 'Jsercy;': '\u0408',
917 'jsercy;': '\u0458',
918 'Jukcy;': '\u0404',
919 'jukcy;': '\u0454',
920 'Kappa;': '\u039a',
921 'kappa;': '\u03ba',
922 'kappav;': '\u03f0',
923 'Kcedil;': '\u0136',
924 'kcedil;': '\u0137',
925 'Kcy;': '\u041a',
926 'kcy;': '\u043a',
927 'Kfr;': '\U0001d50e',
928 'kfr;': '\U0001d528',
929 'kgreen;': '\u0138',
930 'KHcy;': '\u0425',
931 'khcy;': '\u0445',
932 'KJcy;': '\u040c',
933 'kjcy;': '\u045c',
934 'Kopf;': '\U0001d542',
935 'kopf;': '\U0001d55c',
936 'Kscr;': '\U0001d4a6',
937 'kscr;': '\U0001d4c0',
938 'lAarr;': '\u21da',
939 'Lacute;': '\u0139',
940 'lacute;': '\u013a',
941 'laemptyv;': '\u29b4',
942 'lagran;': '\u2112',
943 'Lambda;': '\u039b',
944 'lambda;': '\u03bb',
945 'Lang;': '\u27ea',
946 'lang;': '\u27e8',
947 'langd;': '\u2991',
948 'langle;': '\u27e8',
949 'lap;': '\u2a85',
950 'Laplacetrf;': '\u2112',
951 'laquo': '\xab',
952 'laquo;': '\xab',
953 'Larr;': '\u219e',
954 'lArr;': '\u21d0',
955 'larr;': '\u2190',
956 'larrb;': '\u21e4',
957 'larrbfs;': '\u291f',
958 'larrfs;': '\u291d',
959 'larrhk;': '\u21a9',
960 'larrlp;': '\u21ab',
961 'larrpl;': '\u2939',
962 'larrsim;': '\u2973',
963 'larrtl;': '\u21a2',
964 'lat;': '\u2aab',
965 'lAtail;': '\u291b',
966 'latail;': '\u2919',
967 'late;': '\u2aad',
968 'lates;': '\u2aad\ufe00',
969 'lBarr;': '\u290e',
970 'lbarr;': '\u290c',
971 'lbbrk;': '\u2772',
972 'lbrace;': '{',
973 'lbrack;': '[',
974 'lbrke;': '\u298b',
975 'lbrksld;': '\u298f',
976 'lbrkslu;': '\u298d',
977 'Lcaron;': '\u013d',
978 'lcaron;': '\u013e',
979 'Lcedil;': '\u013b',
980 'lcedil;': '\u013c',
981 'lceil;': '\u2308',
982 'lcub;': '{',
983 'Lcy;': '\u041b',
984 'lcy;': '\u043b',
985 'ldca;': '\u2936',
986 'ldquo;': '\u201c',
987 'ldquor;': '\u201e',
988 'ldrdhar;': '\u2967',
989 'ldrushar;': '\u294b',
990 'ldsh;': '\u21b2',
991 'lE;': '\u2266',
992 'le;': '\u2264',
993 'LeftAngleBracket;': '\u27e8',
994 'LeftArrow;': '\u2190',
995 'Leftarrow;': '\u21d0',
996 'leftarrow;': '\u2190',
997 'LeftArrowBar;': '\u21e4',
998 'LeftArrowRightArrow;': '\u21c6',
999 'leftarrowtail;': '\u21a2',
1000 'LeftCeiling;': '\u2308',
1001 'LeftDoubleBracket;': '\u27e6',
1002 'LeftDownTeeVector;': '\u2961',
1003 'LeftDownVector;': '\u21c3',
1004 'LeftDownVectorBar;': '\u2959',
1005 'LeftFloor;': '\u230a',
1006 'leftharpoondown;': '\u21bd',
1007 'leftharpoonup;': '\u21bc',
1008 'leftleftarrows;': '\u21c7',
1009 'LeftRightArrow;': '\u2194',
1010 'Leftrightarrow;': '\u21d4',
1011 'leftrightarrow;': '\u2194',
1012 'leftrightarrows;': '\u21c6',
1013 'leftrightharpoons;': '\u21cb',
1014 'leftrightsquigarrow;': '\u21ad',
1015 'LeftRightVector;': '\u294e',
1016 'LeftTee;': '\u22a3',
1017 'LeftTeeArrow;': '\u21a4',
1018 'LeftTeeVector;': '\u295a',
1019 'leftthreetimes;': '\u22cb',
1020 'LeftTriangle;': '\u22b2',
1021 'LeftTriangleBar;': '\u29cf',
1022 'LeftTriangleEqual;': '\u22b4',
1023 'LeftUpDownVector;': '\u2951',
1024 'LeftUpTeeVector;': '\u2960',
1025 'LeftUpVector;': '\u21bf',
1026 'LeftUpVectorBar;': '\u2958',
1027 'LeftVector;': '\u21bc',
1028 'LeftVectorBar;': '\u2952',
1029 'lEg;': '\u2a8b',
1030 'leg;': '\u22da',
1031 'leq;': '\u2264',
1032 'leqq;': '\u2266',
1033 'leqslant;': '\u2a7d',
1034 'les;': '\u2a7d',
1035 'lescc;': '\u2aa8',
1036 'lesdot;': '\u2a7f',
1037 'lesdoto;': '\u2a81',
1038 'lesdotor;': '\u2a83',
1039 'lesg;': '\u22da\ufe00',
1040 'lesges;': '\u2a93',
1041 'lessapprox;': '\u2a85',
1042 'lessdot;': '\u22d6',
1043 'lesseqgtr;': '\u22da',
1044 'lesseqqgtr;': '\u2a8b',
1045 'LessEqualGreater;': '\u22da',
1046 'LessFullEqual;': '\u2266',
1047 'LessGreater;': '\u2276',
1048 'lessgtr;': '\u2276',
1049 'LessLess;': '\u2aa1',
1050 'lesssim;': '\u2272',
1051 'LessSlantEqual;': '\u2a7d',
1052 'LessTilde;': '\u2272',
1053 'lfisht;': '\u297c',
1054 'lfloor;': '\u230a',
1055 'Lfr;': '\U0001d50f',
1056 'lfr;': '\U0001d529',
1057 'lg;': '\u2276',
1058 'lgE;': '\u2a91',
1059 'lHar;': '\u2962',
1060 'lhard;': '\u21bd',
1061 'lharu;': '\u21bc',
1062 'lharul;': '\u296a',
1063 'lhblk;': '\u2584',
1064 'LJcy;': '\u0409',
1065 'ljcy;': '\u0459',
1066 'Ll;': '\u22d8',
1067 'll;': '\u226a',
1068 'llarr;': '\u21c7',
1069 'llcorner;': '\u231e',
1070 'Lleftarrow;': '\u21da',
1071 'llhard;': '\u296b',
1072 'lltri;': '\u25fa',
1073 'Lmidot;': '\u013f',
1074 'lmidot;': '\u0140',
1075 'lmoust;': '\u23b0',
1076 'lmoustache;': '\u23b0',
1077 'lnap;': '\u2a89',
1078 'lnapprox;': '\u2a89',
1079 'lnE;': '\u2268',
1080 'lne;': '\u2a87',
1081 'lneq;': '\u2a87',
1082 'lneqq;': '\u2268',
1083 'lnsim;': '\u22e6',
1084 'loang;': '\u27ec',
1085 'loarr;': '\u21fd',
1086 'lobrk;': '\u27e6',
1087 'LongLeftArrow;': '\u27f5',
1088 'Longleftarrow;': '\u27f8',
1089 'longleftarrow;': '\u27f5',
1090 'LongLeftRightArrow;': '\u27f7',
1091 'Longleftrightarrow;': '\u27fa',
1092 'longleftrightarrow;': '\u27f7',
1093 'longmapsto;': '\u27fc',
1094 'LongRightArrow;': '\u27f6',
1095 'Longrightarrow;': '\u27f9',
1096 'longrightarrow;': '\u27f6',
1097 'looparrowleft;': '\u21ab',
1098 'looparrowright;': '\u21ac',
1099 'lopar;': '\u2985',
1100 'Lopf;': '\U0001d543',
1101 'lopf;': '\U0001d55d',
1102 'loplus;': '\u2a2d',
1103 'lotimes;': '\u2a34',
1104 'lowast;': '\u2217',
1105 'lowbar;': '_',
1106 'LowerLeftArrow;': '\u2199',
1107 'LowerRightArrow;': '\u2198',
1108 'loz;': '\u25ca',
1109 'lozenge;': '\u25ca',
1110 'lozf;': '\u29eb',
1111 'lpar;': '(',
1112 'lparlt;': '\u2993',
1113 'lrarr;': '\u21c6',
1114 'lrcorner;': '\u231f',
1115 'lrhar;': '\u21cb',
1116 'lrhard;': '\u296d',
1117 'lrm;': '\u200e',
1118 'lrtri;': '\u22bf',
1119 'lsaquo;': '\u2039',
1120 'Lscr;': '\u2112',
1121 'lscr;': '\U0001d4c1',
1122 'Lsh;': '\u21b0',
1123 'lsh;': '\u21b0',
1124 'lsim;': '\u2272',
1125 'lsime;': '\u2a8d',
1126 'lsimg;': '\u2a8f',
1127 'lsqb;': '[',
1128 'lsquo;': '\u2018',
1129 'lsquor;': '\u201a',
1130 'Lstrok;': '\u0141',
1131 'lstrok;': '\u0142',
1132 'LT': '<',
1133 'lt': '<',
1134 'LT;': '<',
1135 'Lt;': '\u226a',
1136 'lt;': '<',
1137 'ltcc;': '\u2aa6',
1138 'ltcir;': '\u2a79',
1139 'ltdot;': '\u22d6',
1140 'lthree;': '\u22cb',
1141 'ltimes;': '\u22c9',
1142 'ltlarr;': '\u2976',
1143 'ltquest;': '\u2a7b',
1144 'ltri;': '\u25c3',
1145 'ltrie;': '\u22b4',
1146 'ltrif;': '\u25c2',
1147 'ltrPar;': '\u2996',
1148 'lurdshar;': '\u294a',
1149 'luruhar;': '\u2966',
1150 'lvertneqq;': '\u2268\ufe00',
1151 'lvnE;': '\u2268\ufe00',
1152 'macr': '\xaf',
1153 'macr;': '\xaf',
1154 'male;': '\u2642',
1155 'malt;': '\u2720',
1156 'maltese;': '\u2720',
1157 'Map;': '\u2905',
1158 'map;': '\u21a6',
1159 'mapsto;': '\u21a6',
1160 'mapstodown;': '\u21a7',
1161 'mapstoleft;': '\u21a4',
1162 'mapstoup;': '\u21a5',
1163 'marker;': '\u25ae',
1164 'mcomma;': '\u2a29',
1165 'Mcy;': '\u041c',
1166 'mcy;': '\u043c',
1167 'mdash;': '\u2014',
1168 'mDDot;': '\u223a',
1169 'measuredangle;': '\u2221',
1170 'MediumSpace;': '\u205f',
1171 'Mellintrf;': '\u2133',
1172 'Mfr;': '\U0001d510',
1173 'mfr;': '\U0001d52a',
1174 'mho;': '\u2127',
1175 'micro': '\xb5',
1176 'micro;': '\xb5',
1177 'mid;': '\u2223',
1178 'midast;': '*',
1179 'midcir;': '\u2af0',
1180 'middot': '\xb7',
1181 'middot;': '\xb7',
1182 'minus;': '\u2212',
1183 'minusb;': '\u229f',
1184 'minusd;': '\u2238',
1185 'minusdu;': '\u2a2a',
1186 'MinusPlus;': '\u2213',
1187 'mlcp;': '\u2adb',
1188 'mldr;': '\u2026',
1189 'mnplus;': '\u2213',
1190 'models;': '\u22a7',
1191 'Mopf;': '\U0001d544',
1192 'mopf;': '\U0001d55e',
1193 'mp;': '\u2213',
1194 'Mscr;': '\u2133',
1195 'mscr;': '\U0001d4c2',
1196 'mstpos;': '\u223e',
1197 'Mu;': '\u039c',
1198 'mu;': '\u03bc',
1199 'multimap;': '\u22b8',
1200 'mumap;': '\u22b8',
1201 'nabla;': '\u2207',
1202 'Nacute;': '\u0143',
1203 'nacute;': '\u0144',
1204 'nang;': '\u2220\u20d2',
1205 'nap;': '\u2249',
1206 'napE;': '\u2a70\u0338',
1207 'napid;': '\u224b\u0338',
1208 'napos;': '\u0149',
1209 'napprox;': '\u2249',
1210 'natur;': '\u266e',
1211 'natural;': '\u266e',
1212 'naturals;': '\u2115',
1213 'nbsp': '\xa0',
1214 'nbsp;': '\xa0',
1215 'nbump;': '\u224e\u0338',
1216 'nbumpe;': '\u224f\u0338',
1217 'ncap;': '\u2a43',
1218 'Ncaron;': '\u0147',
1219 'ncaron;': '\u0148',
1220 'Ncedil;': '\u0145',
1221 'ncedil;': '\u0146',
1222 'ncong;': '\u2247',
1223 'ncongdot;': '\u2a6d\u0338',
1224 'ncup;': '\u2a42',
1225 'Ncy;': '\u041d',
1226 'ncy;': '\u043d',
1227 'ndash;': '\u2013',
1228 'ne;': '\u2260',
1229 'nearhk;': '\u2924',
1230 'neArr;': '\u21d7',
1231 'nearr;': '\u2197',
1232 'nearrow;': '\u2197',
1233 'nedot;': '\u2250\u0338',
1234 'NegativeMediumSpace;': '\u200b',
1235 'NegativeThickSpace;': '\u200b',
1236 'NegativeThinSpace;': '\u200b',
1237 'NegativeVeryThinSpace;': '\u200b',
1238 'nequiv;': '\u2262',
1239 'nesear;': '\u2928',
1240 'nesim;': '\u2242\u0338',
1241 'NestedGreaterGreater;': '\u226b',
1242 'NestedLessLess;': '\u226a',
1243 'NewLine;': '\n',
1244 'nexist;': '\u2204',
1245 'nexists;': '\u2204',
1246 'Nfr;': '\U0001d511',
1247 'nfr;': '\U0001d52b',
1248 'ngE;': '\u2267\u0338',
1249 'nge;': '\u2271',
1250 'ngeq;': '\u2271',
1251 'ngeqq;': '\u2267\u0338',
1252 'ngeqslant;': '\u2a7e\u0338',
1253 'nges;': '\u2a7e\u0338',
1254 'nGg;': '\u22d9\u0338',
1255 'ngsim;': '\u2275',
1256 'nGt;': '\u226b\u20d2',
1257 'ngt;': '\u226f',
1258 'ngtr;': '\u226f',
1259 'nGtv;': '\u226b\u0338',
1260 'nhArr;': '\u21ce',
1261 'nharr;': '\u21ae',
1262 'nhpar;': '\u2af2',
1263 'ni;': '\u220b',
1264 'nis;': '\u22fc',
1265 'nisd;': '\u22fa',
1266 'niv;': '\u220b',
1267 'NJcy;': '\u040a',
1268 'njcy;': '\u045a',
1269 'nlArr;': '\u21cd',
1270 'nlarr;': '\u219a',
1271 'nldr;': '\u2025',
1272 'nlE;': '\u2266\u0338',
1273 'nle;': '\u2270',
1274 'nLeftarrow;': '\u21cd',
1275 'nleftarrow;': '\u219a',
1276 'nLeftrightarrow;': '\u21ce',
1277 'nleftrightarrow;': '\u21ae',
1278 'nleq;': '\u2270',
1279 'nleqq;': '\u2266\u0338',
1280 'nleqslant;': '\u2a7d\u0338',
1281 'nles;': '\u2a7d\u0338',
1282 'nless;': '\u226e',
1283 'nLl;': '\u22d8\u0338',
1284 'nlsim;': '\u2274',
1285 'nLt;': '\u226a\u20d2',
1286 'nlt;': '\u226e',
1287 'nltri;': '\u22ea',
1288 'nltrie;': '\u22ec',
1289 'nLtv;': '\u226a\u0338',
1290 'nmid;': '\u2224',
1291 'NoBreak;': '\u2060',
1292 'NonBreakingSpace;': '\xa0',
1293 'Nopf;': '\u2115',
1294 'nopf;': '\U0001d55f',
1295 'not': '\xac',
1296 'Not;': '\u2aec',
1297 'not;': '\xac',
1298 'NotCongruent;': '\u2262',
1299 'NotCupCap;': '\u226d',
1300 'NotDoubleVerticalBar;': '\u2226',
1301 'NotElement;': '\u2209',
1302 'NotEqual;': '\u2260',
1303 'NotEqualTilde;': '\u2242\u0338',
1304 'NotExists;': '\u2204',
1305 'NotGreater;': '\u226f',
1306 'NotGreaterEqual;': '\u2271',
1307 'NotGreaterFullEqual;': '\u2267\u0338',
1308 'NotGreaterGreater;': '\u226b\u0338',
1309 'NotGreaterLess;': '\u2279',
1310 'NotGreaterSlantEqual;': '\u2a7e\u0338',
1311 'NotGreaterTilde;': '\u2275',
1312 'NotHumpDownHump;': '\u224e\u0338',
1313 'NotHumpEqual;': '\u224f\u0338',
1314 'notin;': '\u2209',
1315 'notindot;': '\u22f5\u0338',
1316 'notinE;': '\u22f9\u0338',
1317 'notinva;': '\u2209',
1318 'notinvb;': '\u22f7',
1319 'notinvc;': '\u22f6',
1320 'NotLeftTriangle;': '\u22ea',
1321 'NotLeftTriangleBar;': '\u29cf\u0338',
1322 'NotLeftTriangleEqual;': '\u22ec',
1323 'NotLess;': '\u226e',
1324 'NotLessEqual;': '\u2270',
1325 'NotLessGreater;': '\u2278',
1326 'NotLessLess;': '\u226a\u0338',
1327 'NotLessSlantEqual;': '\u2a7d\u0338',
1328 'NotLessTilde;': '\u2274',
1329 'NotNestedGreaterGreater;': '\u2aa2\u0338',
1330 'NotNestedLessLess;': '\u2aa1\u0338',
1331 'notni;': '\u220c',
1332 'notniva;': '\u220c',
1333 'notnivb;': '\u22fe',
1334 'notnivc;': '\u22fd',
1335 'NotPrecedes;': '\u2280',
1336 'NotPrecedesEqual;': '\u2aaf\u0338',
1337 'NotPrecedesSlantEqual;': '\u22e0',
1338 'NotReverseElement;': '\u220c',
1339 'NotRightTriangle;': '\u22eb',
1340 'NotRightTriangleBar;': '\u29d0\u0338',
1341 'NotRightTriangleEqual;': '\u22ed',
1342 'NotSquareSubset;': '\u228f\u0338',
1343 'NotSquareSubsetEqual;': '\u22e2',
1344 'NotSquareSuperset;': '\u2290\u0338',
1345 'NotSquareSupersetEqual;': '\u22e3',
1346 'NotSubset;': '\u2282\u20d2',
1347 'NotSubsetEqual;': '\u2288',
1348 'NotSucceeds;': '\u2281',
1349 'NotSucceedsEqual;': '\u2ab0\u0338',
1350 'NotSucceedsSlantEqual;': '\u22e1',
1351 'NotSucceedsTilde;': '\u227f\u0338',
1352 'NotSuperset;': '\u2283\u20d2',
1353 'NotSupersetEqual;': '\u2289',
1354 'NotTilde;': '\u2241',
1355 'NotTildeEqual;': '\u2244',
1356 'NotTildeFullEqual;': '\u2247',
1357 'NotTildeTilde;': '\u2249',
1358 'NotVerticalBar;': '\u2224',
1359 'npar;': '\u2226',
1360 'nparallel;': '\u2226',
1361 'nparsl;': '\u2afd\u20e5',
1362 'npart;': '\u2202\u0338',
1363 'npolint;': '\u2a14',
1364 'npr;': '\u2280',
1365 'nprcue;': '\u22e0',
1366 'npre;': '\u2aaf\u0338',
1367 'nprec;': '\u2280',
1368 'npreceq;': '\u2aaf\u0338',
1369 'nrArr;': '\u21cf',
1370 'nrarr;': '\u219b',
1371 'nrarrc;': '\u2933\u0338',
1372 'nrarrw;': '\u219d\u0338',
1373 'nRightarrow;': '\u21cf',
1374 'nrightarrow;': '\u219b',
1375 'nrtri;': '\u22eb',
1376 'nrtrie;': '\u22ed',
1377 'nsc;': '\u2281',
1378 'nsccue;': '\u22e1',
1379 'nsce;': '\u2ab0\u0338',
1380 'Nscr;': '\U0001d4a9',
1381 'nscr;': '\U0001d4c3',
1382 'nshortmid;': '\u2224',
1383 'nshortparallel;': '\u2226',
1384 'nsim;': '\u2241',
1385 'nsime;': '\u2244',
1386 'nsimeq;': '\u2244',
1387 'nsmid;': '\u2224',
1388 'nspar;': '\u2226',
1389 'nsqsube;': '\u22e2',
1390 'nsqsupe;': '\u22e3',
1391 'nsub;': '\u2284',
1392 'nsubE;': '\u2ac5\u0338',
1393 'nsube;': '\u2288',
1394 'nsubset;': '\u2282\u20d2',
1395 'nsubseteq;': '\u2288',
1396 'nsubseteqq;': '\u2ac5\u0338',
1397 'nsucc;': '\u2281',
1398 'nsucceq;': '\u2ab0\u0338',
1399 'nsup;': '\u2285',
1400 'nsupE;': '\u2ac6\u0338',
1401 'nsupe;': '\u2289',
1402 'nsupset;': '\u2283\u20d2',
1403 'nsupseteq;': '\u2289',
1404 'nsupseteqq;': '\u2ac6\u0338',
1405 'ntgl;': '\u2279',
1406 'Ntilde': '\xd1',
1407 'ntilde': '\xf1',
1408 'Ntilde;': '\xd1',
1409 'ntilde;': '\xf1',
1410 'ntlg;': '\u2278',
1411 'ntriangleleft;': '\u22ea',
1412 'ntrianglelefteq;': '\u22ec',
1413 'ntriangleright;': '\u22eb',
1414 'ntrianglerighteq;': '\u22ed',
1415 'Nu;': '\u039d',
1416 'nu;': '\u03bd',
1417 'num;': '#',
1418 'numero;': '\u2116',
1419 'numsp;': '\u2007',
1420 'nvap;': '\u224d\u20d2',
1421 'nVDash;': '\u22af',
1422 'nVdash;': '\u22ae',
1423 'nvDash;': '\u22ad',
1424 'nvdash;': '\u22ac',
1425 'nvge;': '\u2265\u20d2',
1426 'nvgt;': '>\u20d2',
1427 'nvHarr;': '\u2904',
1428 'nvinfin;': '\u29de',
1429 'nvlArr;': '\u2902',
1430 'nvle;': '\u2264\u20d2',
1431 'nvlt;': '<\u20d2',
1432 'nvltrie;': '\u22b4\u20d2',
1433 'nvrArr;': '\u2903',
1434 'nvrtrie;': '\u22b5\u20d2',
1435 'nvsim;': '\u223c\u20d2',
1436 'nwarhk;': '\u2923',
1437 'nwArr;': '\u21d6',
1438 'nwarr;': '\u2196',
1439 'nwarrow;': '\u2196',
1440 'nwnear;': '\u2927',
1441 'Oacute': '\xd3',
1442 'oacute': '\xf3',
1443 'Oacute;': '\xd3',
1444 'oacute;': '\xf3',
1445 'oast;': '\u229b',
1446 'ocir;': '\u229a',
1447 'Ocirc': '\xd4',
1448 'ocirc': '\xf4',
1449 'Ocirc;': '\xd4',
1450 'ocirc;': '\xf4',
1451 'Ocy;': '\u041e',
1452 'ocy;': '\u043e',
1453 'odash;': '\u229d',
1454 'Odblac;': '\u0150',
1455 'odblac;': '\u0151',
1456 'odiv;': '\u2a38',
1457 'odot;': '\u2299',
1458 'odsold;': '\u29bc',
1459 'OElig;': '\u0152',
1460 'oelig;': '\u0153',
1461 'ofcir;': '\u29bf',
1462 'Ofr;': '\U0001d512',
1463 'ofr;': '\U0001d52c',
1464 'ogon;': '\u02db',
1465 'Ograve': '\xd2',
1466 'ograve': '\xf2',
1467 'Ograve;': '\xd2',
1468 'ograve;': '\xf2',
1469 'ogt;': '\u29c1',
1470 'ohbar;': '\u29b5',
1471 'ohm;': '\u03a9',
1472 'oint;': '\u222e',
1473 'olarr;': '\u21ba',
1474 'olcir;': '\u29be',
1475 'olcross;': '\u29bb',
1476 'oline;': '\u203e',
1477 'olt;': '\u29c0',
1478 'Omacr;': '\u014c',
1479 'omacr;': '\u014d',
1480 'Omega;': '\u03a9',
1481 'omega;': '\u03c9',
1482 'Omicron;': '\u039f',
1483 'omicron;': '\u03bf',
1484 'omid;': '\u29b6',
1485 'ominus;': '\u2296',
1486 'Oopf;': '\U0001d546',
1487 'oopf;': '\U0001d560',
1488 'opar;': '\u29b7',
1489 'OpenCurlyDoubleQuote;': '\u201c',
1490 'OpenCurlyQuote;': '\u2018',
1491 'operp;': '\u29b9',
1492 'oplus;': '\u2295',
1493 'Or;': '\u2a54',
1494 'or;': '\u2228',
1495 'orarr;': '\u21bb',
1496 'ord;': '\u2a5d',
1497 'order;': '\u2134',
1498 'orderof;': '\u2134',
1499 'ordf': '\xaa',
1500 'ordf;': '\xaa',
1501 'ordm': '\xba',
1502 'ordm;': '\xba',
1503 'origof;': '\u22b6',
1504 'oror;': '\u2a56',
1505 'orslope;': '\u2a57',
1506 'orv;': '\u2a5b',
1507 'oS;': '\u24c8',
1508 'Oscr;': '\U0001d4aa',
1509 'oscr;': '\u2134',
1510 'Oslash': '\xd8',
1511 'oslash': '\xf8',
1512 'Oslash;': '\xd8',
1513 'oslash;': '\xf8',
1514 'osol;': '\u2298',
1515 'Otilde': '\xd5',
1516 'otilde': '\xf5',
1517 'Otilde;': '\xd5',
1518 'otilde;': '\xf5',
1519 'Otimes;': '\u2a37',
1520 'otimes;': '\u2297',
1521 'otimesas;': '\u2a36',
1522 'Ouml': '\xd6',
1523 'ouml': '\xf6',
1524 'Ouml;': '\xd6',
1525 'ouml;': '\xf6',
1526 'ovbar;': '\u233d',
1527 'OverBar;': '\u203e',
1528 'OverBrace;': '\u23de',
1529 'OverBracket;': '\u23b4',
1530 'OverParenthesis;': '\u23dc',
1531 'par;': '\u2225',
1532 'para': '\xb6',
1533 'para;': '\xb6',
1534 'parallel;': '\u2225',
1535 'parsim;': '\u2af3',
1536 'parsl;': '\u2afd',
1537 'part;': '\u2202',
1538 'PartialD;': '\u2202',
1539 'Pcy;': '\u041f',
1540 'pcy;': '\u043f',
1541 'percnt;': '%',
1542 'period;': '.',
1543 'permil;': '\u2030',
1544 'perp;': '\u22a5',
1545 'pertenk;': '\u2031',
1546 'Pfr;': '\U0001d513',
1547 'pfr;': '\U0001d52d',
1548 'Phi;': '\u03a6',
1549 'phi;': '\u03c6',
1550 'phiv;': '\u03d5',
1551 'phmmat;': '\u2133',
1552 'phone;': '\u260e',
1553 'Pi;': '\u03a0',
1554 'pi;': '\u03c0',
1555 'pitchfork;': '\u22d4',
1556 'piv;': '\u03d6',
1557 'planck;': '\u210f',
1558 'planckh;': '\u210e',
1559 'plankv;': '\u210f',
1560 'plus;': '+',
1561 'plusacir;': '\u2a23',
1562 'plusb;': '\u229e',
1563 'pluscir;': '\u2a22',
1564 'plusdo;': '\u2214',
1565 'plusdu;': '\u2a25',
1566 'pluse;': '\u2a72',
1567 'PlusMinus;': '\xb1',
1568 'plusmn': '\xb1',
1569 'plusmn;': '\xb1',
1570 'plussim;': '\u2a26',
1571 'plustwo;': '\u2a27',
1572 'pm;': '\xb1',
1573 'Poincareplane;': '\u210c',
1574 'pointint;': '\u2a15',
1575 'Popf;': '\u2119',
1576 'popf;': '\U0001d561',
1577 'pound': '\xa3',
1578 'pound;': '\xa3',
1579 'Pr;': '\u2abb',
1580 'pr;': '\u227a',
1581 'prap;': '\u2ab7',
1582 'prcue;': '\u227c',
1583 'prE;': '\u2ab3',
1584 'pre;': '\u2aaf',
1585 'prec;': '\u227a',
1586 'precapprox;': '\u2ab7',
1587 'preccurlyeq;': '\u227c',
1588 'Precedes;': '\u227a',
1589 'PrecedesEqual;': '\u2aaf',
1590 'PrecedesSlantEqual;': '\u227c',
1591 'PrecedesTilde;': '\u227e',
1592 'preceq;': '\u2aaf',
1593 'precnapprox;': '\u2ab9',
1594 'precneqq;': '\u2ab5',
1595 'precnsim;': '\u22e8',
1596 'precsim;': '\u227e',
1597 'Prime;': '\u2033',
1598 'prime;': '\u2032',
1599 'primes;': '\u2119',
1600 'prnap;': '\u2ab9',
1601 'prnE;': '\u2ab5',
1602 'prnsim;': '\u22e8',
1603 'prod;': '\u220f',
1604 'Product;': '\u220f',
1605 'profalar;': '\u232e',
1606 'profline;': '\u2312',
1607 'profsurf;': '\u2313',
1608 'prop;': '\u221d',
1609 'Proportion;': '\u2237',
1610 'Proportional;': '\u221d',
1611 'propto;': '\u221d',
1612 'prsim;': '\u227e',
1613 'prurel;': '\u22b0',
1614 'Pscr;': '\U0001d4ab',
1615 'pscr;': '\U0001d4c5',
1616 'Psi;': '\u03a8',
1617 'psi;': '\u03c8',
1618 'puncsp;': '\u2008',
1619 'Qfr;': '\U0001d514',
1620 'qfr;': '\U0001d52e',
1621 'qint;': '\u2a0c',
1622 'Qopf;': '\u211a',
1623 'qopf;': '\U0001d562',
1624 'qprime;': '\u2057',
1625 'Qscr;': '\U0001d4ac',
1626 'qscr;': '\U0001d4c6',
1627 'quaternions;': '\u210d',
1628 'quatint;': '\u2a16',
1629 'quest;': '?',
1630 'questeq;': '\u225f',
1631 'QUOT': '"',
1632 'quot': '"',
1633 'QUOT;': '"',
1634 'quot;': '"',
1635 'rAarr;': '\u21db',
1636 'race;': '\u223d\u0331',
1637 'Racute;': '\u0154',
1638 'racute;': '\u0155',
1639 'radic;': '\u221a',
1640 'raemptyv;': '\u29b3',
1641 'Rang;': '\u27eb',
1642 'rang;': '\u27e9',
1643 'rangd;': '\u2992',
1644 'range;': '\u29a5',
1645 'rangle;': '\u27e9',
1646 'raquo': '\xbb',
1647 'raquo;': '\xbb',
1648 'Rarr;': '\u21a0',
1649 'rArr;': '\u21d2',
1650 'rarr;': '\u2192',
1651 'rarrap;': '\u2975',
1652 'rarrb;': '\u21e5',
1653 'rarrbfs;': '\u2920',
1654 'rarrc;': '\u2933',
1655 'rarrfs;': '\u291e',
1656 'rarrhk;': '\u21aa',
1657 'rarrlp;': '\u21ac',
1658 'rarrpl;': '\u2945',
1659 'rarrsim;': '\u2974',
1660 'Rarrtl;': '\u2916',
1661 'rarrtl;': '\u21a3',
1662 'rarrw;': '\u219d',
1663 'rAtail;': '\u291c',
1664 'ratail;': '\u291a',
1665 'ratio;': '\u2236',
1666 'rationals;': '\u211a',
1667 'RBarr;': '\u2910',
1668 'rBarr;': '\u290f',
1669 'rbarr;': '\u290d',
1670 'rbbrk;': '\u2773',
1671 'rbrace;': '}',
1672 'rbrack;': ']',
1673 'rbrke;': '\u298c',
1674 'rbrksld;': '\u298e',
1675 'rbrkslu;': '\u2990',
1676 'Rcaron;': '\u0158',
1677 'rcaron;': '\u0159',
1678 'Rcedil;': '\u0156',
1679 'rcedil;': '\u0157',
1680 'rceil;': '\u2309',
1681 'rcub;': '}',
1682 'Rcy;': '\u0420',
1683 'rcy;': '\u0440',
1684 'rdca;': '\u2937',
1685 'rdldhar;': '\u2969',
1686 'rdquo;': '\u201d',
1687 'rdquor;': '\u201d',
1688 'rdsh;': '\u21b3',
1689 'Re;': '\u211c',
1690 'real;': '\u211c',
1691 'realine;': '\u211b',
1692 'realpart;': '\u211c',
1693 'reals;': '\u211d',
1694 'rect;': '\u25ad',
1695 'REG': '\xae',
1696 'reg': '\xae',
1697 'REG;': '\xae',
1698 'reg;': '\xae',
1699 'ReverseElement;': '\u220b',
1700 'ReverseEquilibrium;': '\u21cb',
1701 'ReverseUpEquilibrium;': '\u296f',
1702 'rfisht;': '\u297d',
1703 'rfloor;': '\u230b',
1704 'Rfr;': '\u211c',
1705 'rfr;': '\U0001d52f',
1706 'rHar;': '\u2964',
1707 'rhard;': '\u21c1',
1708 'rharu;': '\u21c0',
1709 'rharul;': '\u296c',
1710 'Rho;': '\u03a1',
1711 'rho;': '\u03c1',
1712 'rhov;': '\u03f1',
1713 'RightAngleBracket;': '\u27e9',
1714 'RightArrow;': '\u2192',
1715 'Rightarrow;': '\u21d2',
1716 'rightarrow;': '\u2192',
1717 'RightArrowBar;': '\u21e5',
1718 'RightArrowLeftArrow;': '\u21c4',
1719 'rightarrowtail;': '\u21a3',
1720 'RightCeiling;': '\u2309',
1721 'RightDoubleBracket;': '\u27e7',
1722 'RightDownTeeVector;': '\u295d',
1723 'RightDownVector;': '\u21c2',
1724 'RightDownVectorBar;': '\u2955',
1725 'RightFloor;': '\u230b',
1726 'rightharpoondown;': '\u21c1',
1727 'rightharpoonup;': '\u21c0',
1728 'rightleftarrows;': '\u21c4',
1729 'rightleftharpoons;': '\u21cc',
1730 'rightrightarrows;': '\u21c9',
1731 'rightsquigarrow;': '\u219d',
1732 'RightTee;': '\u22a2',
1733 'RightTeeArrow;': '\u21a6',
1734 'RightTeeVector;': '\u295b',
1735 'rightthreetimes;': '\u22cc',
1736 'RightTriangle;': '\u22b3',
1737 'RightTriangleBar;': '\u29d0',
1738 'RightTriangleEqual;': '\u22b5',
1739 'RightUpDownVector;': '\u294f',
1740 'RightUpTeeVector;': '\u295c',
1741 'RightUpVector;': '\u21be',
1742 'RightUpVectorBar;': '\u2954',
1743 'RightVector;': '\u21c0',
1744 'RightVectorBar;': '\u2953',
1745 'ring;': '\u02da',
1746 'risingdotseq;': '\u2253',
1747 'rlarr;': '\u21c4',
1748 'rlhar;': '\u21cc',
1749 'rlm;': '\u200f',
1750 'rmoust;': '\u23b1',
1751 'rmoustache;': '\u23b1',
1752 'rnmid;': '\u2aee',
1753 'roang;': '\u27ed',
1754 'roarr;': '\u21fe',
1755 'robrk;': '\u27e7',
1756 'ropar;': '\u2986',
1757 'Ropf;': '\u211d',
1758 'ropf;': '\U0001d563',
1759 'roplus;': '\u2a2e',
1760 'rotimes;': '\u2a35',
1761 'RoundImplies;': '\u2970',
1762 'rpar;': ')',
1763 'rpargt;': '\u2994',
1764 'rppolint;': '\u2a12',
1765 'rrarr;': '\u21c9',
1766 'Rrightarrow;': '\u21db',
1767 'rsaquo;': '\u203a',
1768 'Rscr;': '\u211b',
1769 'rscr;': '\U0001d4c7',
1770 'Rsh;': '\u21b1',
1771 'rsh;': '\u21b1',
1772 'rsqb;': ']',
1773 'rsquo;': '\u2019',
1774 'rsquor;': '\u2019',
1775 'rthree;': '\u22cc',
1776 'rtimes;': '\u22ca',
1777 'rtri;': '\u25b9',
1778 'rtrie;': '\u22b5',
1779 'rtrif;': '\u25b8',
1780 'rtriltri;': '\u29ce',
1781 'RuleDelayed;': '\u29f4',
1782 'ruluhar;': '\u2968',
1783 'rx;': '\u211e',
1784 'Sacute;': '\u015a',
1785 'sacute;': '\u015b',
1786 'sbquo;': '\u201a',
1787 'Sc;': '\u2abc',
1788 'sc;': '\u227b',
1789 'scap;': '\u2ab8',
1790 'Scaron;': '\u0160',
1791 'scaron;': '\u0161',
1792 'sccue;': '\u227d',
1793 'scE;': '\u2ab4',
1794 'sce;': '\u2ab0',
1795 'Scedil;': '\u015e',
1796 'scedil;': '\u015f',
1797 'Scirc;': '\u015c',
1798 'scirc;': '\u015d',
1799 'scnap;': '\u2aba',
1800 'scnE;': '\u2ab6',
1801 'scnsim;': '\u22e9',
1802 'scpolint;': '\u2a13',
1803 'scsim;': '\u227f',
1804 'Scy;': '\u0421',
1805 'scy;': '\u0441',
1806 'sdot;': '\u22c5',
1807 'sdotb;': '\u22a1',
1808 'sdote;': '\u2a66',
1809 'searhk;': '\u2925',
1810 'seArr;': '\u21d8',
1811 'searr;': '\u2198',
1812 'searrow;': '\u2198',
1813 'sect': '\xa7',
1814 'sect;': '\xa7',
1815 'semi;': ';',
1816 'seswar;': '\u2929',
1817 'setminus;': '\u2216',
1818 'setmn;': '\u2216',
1819 'sext;': '\u2736',
1820 'Sfr;': '\U0001d516',
1821 'sfr;': '\U0001d530',
1822 'sfrown;': '\u2322',
1823 'sharp;': '\u266f',
1824 'SHCHcy;': '\u0429',
1825 'shchcy;': '\u0449',
1826 'SHcy;': '\u0428',
1827 'shcy;': '\u0448',
1828 'ShortDownArrow;': '\u2193',
1829 'ShortLeftArrow;': '\u2190',
1830 'shortmid;': '\u2223',
1831 'shortparallel;': '\u2225',
1832 'ShortRightArrow;': '\u2192',
1833 'ShortUpArrow;': '\u2191',
1834 'shy': '\xad',
1835 'shy;': '\xad',
1836 'Sigma;': '\u03a3',
1837 'sigma;': '\u03c3',
1838 'sigmaf;': '\u03c2',
1839 'sigmav;': '\u03c2',
1840 'sim;': '\u223c',
1841 'simdot;': '\u2a6a',
1842 'sime;': '\u2243',
1843 'simeq;': '\u2243',
1844 'simg;': '\u2a9e',
1845 'simgE;': '\u2aa0',
1846 'siml;': '\u2a9d',
1847 'simlE;': '\u2a9f',
1848 'simne;': '\u2246',
1849 'simplus;': '\u2a24',
1850 'simrarr;': '\u2972',
1851 'slarr;': '\u2190',
1852 'SmallCircle;': '\u2218',
1853 'smallsetminus;': '\u2216',
1854 'smashp;': '\u2a33',
1855 'smeparsl;': '\u29e4',
1856 'smid;': '\u2223',
1857 'smile;': '\u2323',
1858 'smt;': '\u2aaa',
1859 'smte;': '\u2aac',
1860 'smtes;': '\u2aac\ufe00',
1861 'SOFTcy;': '\u042c',
1862 'softcy;': '\u044c',
1863 'sol;': '/',
1864 'solb;': '\u29c4',
1865 'solbar;': '\u233f',
1866 'Sopf;': '\U0001d54a',
1867 'sopf;': '\U0001d564',
1868 'spades;': '\u2660',
1869 'spadesuit;': '\u2660',
1870 'spar;': '\u2225',
1871 'sqcap;': '\u2293',
1872 'sqcaps;': '\u2293\ufe00',
1873 'sqcup;': '\u2294',
1874 'sqcups;': '\u2294\ufe00',
1875 'Sqrt;': '\u221a',
1876 'sqsub;': '\u228f',
1877 'sqsube;': '\u2291',
1878 'sqsubset;': '\u228f',
1879 'sqsubseteq;': '\u2291',
1880 'sqsup;': '\u2290',
1881 'sqsupe;': '\u2292',
1882 'sqsupset;': '\u2290',
1883 'sqsupseteq;': '\u2292',
1884 'squ;': '\u25a1',
1885 'Square;': '\u25a1',
1886 'square;': '\u25a1',
1887 'SquareIntersection;': '\u2293',
1888 'SquareSubset;': '\u228f',
1889 'SquareSubsetEqual;': '\u2291',
1890 'SquareSuperset;': '\u2290',
1891 'SquareSupersetEqual;': '\u2292',
1892 'SquareUnion;': '\u2294',
1893 'squarf;': '\u25aa',
1894 'squf;': '\u25aa',
1895 'srarr;': '\u2192',
1896 'Sscr;': '\U0001d4ae',
1897 'sscr;': '\U0001d4c8',
1898 'ssetmn;': '\u2216',
1899 'ssmile;': '\u2323',
1900 'sstarf;': '\u22c6',
1901 'Star;': '\u22c6',
1902 'star;': '\u2606',
1903 'starf;': '\u2605',
1904 'straightepsilon;': '\u03f5',
1905 'straightphi;': '\u03d5',
1906 'strns;': '\xaf',
1907 'Sub;': '\u22d0',
1908 'sub;': '\u2282',
1909 'subdot;': '\u2abd',
1910 'subE;': '\u2ac5',
1911 'sube;': '\u2286',
1912 'subedot;': '\u2ac3',
1913 'submult;': '\u2ac1',
1914 'subnE;': '\u2acb',
1915 'subne;': '\u228a',
1916 'subplus;': '\u2abf',
1917 'subrarr;': '\u2979',
1918 'Subset;': '\u22d0',
1919 'subset;': '\u2282',
1920 'subseteq;': '\u2286',
1921 'subseteqq;': '\u2ac5',
1922 'SubsetEqual;': '\u2286',
1923 'subsetneq;': '\u228a',
1924 'subsetneqq;': '\u2acb',
1925 'subsim;': '\u2ac7',
1926 'subsub;': '\u2ad5',
1927 'subsup;': '\u2ad3',
1928 'succ;': '\u227b',
1929 'succapprox;': '\u2ab8',
1930 'succcurlyeq;': '\u227d',
1931 'Succeeds;': '\u227b',
1932 'SucceedsEqual;': '\u2ab0',
1933 'SucceedsSlantEqual;': '\u227d',
1934 'SucceedsTilde;': '\u227f',
1935 'succeq;': '\u2ab0',
1936 'succnapprox;': '\u2aba',
1937 'succneqq;': '\u2ab6',
1938 'succnsim;': '\u22e9',
1939 'succsim;': '\u227f',
1940 'SuchThat;': '\u220b',
1941 'Sum;': '\u2211',
1942 'sum;': '\u2211',
1943 'sung;': '\u266a',
1944 'sup1': '\xb9',
1945 'sup1;': '\xb9',
1946 'sup2': '\xb2',
1947 'sup2;': '\xb2',
1948 'sup3': '\xb3',
1949 'sup3;': '\xb3',
1950 'Sup;': '\u22d1',
1951 'sup;': '\u2283',
1952 'supdot;': '\u2abe',
1953 'supdsub;': '\u2ad8',
1954 'supE;': '\u2ac6',
1955 'supe;': '\u2287',
1956 'supedot;': '\u2ac4',
1957 'Superset;': '\u2283',
1958 'SupersetEqual;': '\u2287',
1959 'suphsol;': '\u27c9',
1960 'suphsub;': '\u2ad7',
1961 'suplarr;': '\u297b',
1962 'supmult;': '\u2ac2',
1963 'supnE;': '\u2acc',
1964 'supne;': '\u228b',
1965 'supplus;': '\u2ac0',
1966 'Supset;': '\u22d1',
1967 'supset;': '\u2283',
1968 'supseteq;': '\u2287',
1969 'supseteqq;': '\u2ac6',
1970 'supsetneq;': '\u228b',
1971 'supsetneqq;': '\u2acc',
1972 'supsim;': '\u2ac8',
1973 'supsub;': '\u2ad4',
1974 'supsup;': '\u2ad6',
1975 'swarhk;': '\u2926',
1976 'swArr;': '\u21d9',
1977 'swarr;': '\u2199',
1978 'swarrow;': '\u2199',
1979 'swnwar;': '\u292a',
1980 'szlig': '\xdf',
1981 'szlig;': '\xdf',
1982 'Tab;': '\t',
1983 'target;': '\u2316',
1984 'Tau;': '\u03a4',
1985 'tau;': '\u03c4',
1986 'tbrk;': '\u23b4',
1987 'Tcaron;': '\u0164',
1988 'tcaron;': '\u0165',
1989 'Tcedil;': '\u0162',
1990 'tcedil;': '\u0163',
1991 'Tcy;': '\u0422',
1992 'tcy;': '\u0442',
1993 'tdot;': '\u20db',
1994 'telrec;': '\u2315',
1995 'Tfr;': '\U0001d517',
1996 'tfr;': '\U0001d531',
1997 'there4;': '\u2234',
1998 'Therefore;': '\u2234',
1999 'therefore;': '\u2234',
2000 'Theta;': '\u0398',
2001 'theta;': '\u03b8',
2002 'thetasym;': '\u03d1',
2003 'thetav;': '\u03d1',
2004 'thickapprox;': '\u2248',
2005 'thicksim;': '\u223c',
2006 'ThickSpace;': '\u205f\u200a',
2007 'thinsp;': '\u2009',
2008 'ThinSpace;': '\u2009',
2009 'thkap;': '\u2248',
2010 'thksim;': '\u223c',
2011 'THORN': '\xde',
2012 'thorn': '\xfe',
2013 'THORN;': '\xde',
2014 'thorn;': '\xfe',
2015 'Tilde;': '\u223c',
2016 'tilde;': '\u02dc',
2017 'TildeEqual;': '\u2243',
2018 'TildeFullEqual;': '\u2245',
2019 'TildeTilde;': '\u2248',
2020 'times': '\xd7',
2021 'times;': '\xd7',
2022 'timesb;': '\u22a0',
2023 'timesbar;': '\u2a31',
2024 'timesd;': '\u2a30',
2025 'tint;': '\u222d',
2026 'toea;': '\u2928',
2027 'top;': '\u22a4',
2028 'topbot;': '\u2336',
2029 'topcir;': '\u2af1',
2030 'Topf;': '\U0001d54b',
2031 'topf;': '\U0001d565',
2032 'topfork;': '\u2ada',
2033 'tosa;': '\u2929',
2034 'tprime;': '\u2034',
2035 'TRADE;': '\u2122',
2036 'trade;': '\u2122',
2037 'triangle;': '\u25b5',
2038 'triangledown;': '\u25bf',
2039 'triangleleft;': '\u25c3',
2040 'trianglelefteq;': '\u22b4',
2041 'triangleq;': '\u225c',
2042 'triangleright;': '\u25b9',
2043 'trianglerighteq;': '\u22b5',
2044 'tridot;': '\u25ec',
2045 'trie;': '\u225c',
2046 'triminus;': '\u2a3a',
2047 'TripleDot;': '\u20db',
2048 'triplus;': '\u2a39',
2049 'trisb;': '\u29cd',
2050 'tritime;': '\u2a3b',
2051 'trpezium;': '\u23e2',
2052 'Tscr;': '\U0001d4af',
2053 'tscr;': '\U0001d4c9',
2054 'TScy;': '\u0426',
2055 'tscy;': '\u0446',
2056 'TSHcy;': '\u040b',
2057 'tshcy;': '\u045b',
2058 'Tstrok;': '\u0166',
2059 'tstrok;': '\u0167',
2060 'twixt;': '\u226c',
2061 'twoheadleftarrow;': '\u219e',
2062 'twoheadrightarrow;': '\u21a0',
2063 'Uacute': '\xda',
2064 'uacute': '\xfa',
2065 'Uacute;': '\xda',
2066 'uacute;': '\xfa',
2067 'Uarr;': '\u219f',
2068 'uArr;': '\u21d1',
2069 'uarr;': '\u2191',
2070 'Uarrocir;': '\u2949',
2071 'Ubrcy;': '\u040e',
2072 'ubrcy;': '\u045e',
2073 'Ubreve;': '\u016c',
2074 'ubreve;': '\u016d',
2075 'Ucirc': '\xdb',
2076 'ucirc': '\xfb',
2077 'Ucirc;': '\xdb',
2078 'ucirc;': '\xfb',
2079 'Ucy;': '\u0423',
2080 'ucy;': '\u0443',
2081 'udarr;': '\u21c5',
2082 'Udblac;': '\u0170',
2083 'udblac;': '\u0171',
2084 'udhar;': '\u296e',
2085 'ufisht;': '\u297e',
2086 'Ufr;': '\U0001d518',
2087 'ufr;': '\U0001d532',
2088 'Ugrave': '\xd9',
2089 'ugrave': '\xf9',
2090 'Ugrave;': '\xd9',
2091 'ugrave;': '\xf9',
2092 'uHar;': '\u2963',
2093 'uharl;': '\u21bf',
2094 'uharr;': '\u21be',
2095 'uhblk;': '\u2580',
2096 'ulcorn;': '\u231c',
2097 'ulcorner;': '\u231c',
2098 'ulcrop;': '\u230f',
2099 'ultri;': '\u25f8',
2100 'Umacr;': '\u016a',
2101 'umacr;': '\u016b',
2102 'uml': '\xa8',
2103 'uml;': '\xa8',
2104 'UnderBar;': '_',
2105 'UnderBrace;': '\u23df',
2106 'UnderBracket;': '\u23b5',
2107 'UnderParenthesis;': '\u23dd',
2108 'Union;': '\u22c3',
2109 'UnionPlus;': '\u228e',
2110 'Uogon;': '\u0172',
2111 'uogon;': '\u0173',
2112 'Uopf;': '\U0001d54c',
2113 'uopf;': '\U0001d566',
2114 'UpArrow;': '\u2191',
2115 'Uparrow;': '\u21d1',
2116 'uparrow;': '\u2191',
2117 'UpArrowBar;': '\u2912',
2118 'UpArrowDownArrow;': '\u21c5',
2119 'UpDownArrow;': '\u2195',
2120 'Updownarrow;': '\u21d5',
2121 'updownarrow;': '\u2195',
2122 'UpEquilibrium;': '\u296e',
2123 'upharpoonleft;': '\u21bf',
2124 'upharpoonright;': '\u21be',
2125 'uplus;': '\u228e',
2126 'UpperLeftArrow;': '\u2196',
2127 'UpperRightArrow;': '\u2197',
2128 'Upsi;': '\u03d2',
2129 'upsi;': '\u03c5',
2130 'upsih;': '\u03d2',
2131 'Upsilon;': '\u03a5',
2132 'upsilon;': '\u03c5',
2133 'UpTee;': '\u22a5',
2134 'UpTeeArrow;': '\u21a5',
2135 'upuparrows;': '\u21c8',
2136 'urcorn;': '\u231d',
2137 'urcorner;': '\u231d',
2138 'urcrop;': '\u230e',
2139 'Uring;': '\u016e',
2140 'uring;': '\u016f',
2141 'urtri;': '\u25f9',
2142 'Uscr;': '\U0001d4b0',
2143 'uscr;': '\U0001d4ca',
2144 'utdot;': '\u22f0',
2145 'Utilde;': '\u0168',
2146 'utilde;': '\u0169',
2147 'utri;': '\u25b5',
2148 'utrif;': '\u25b4',
2149 'uuarr;': '\u21c8',
2150 'Uuml': '\xdc',
2151 'uuml': '\xfc',
2152 'Uuml;': '\xdc',
2153 'uuml;': '\xfc',
2154 'uwangle;': '\u29a7',
2155 'vangrt;': '\u299c',
2156 'varepsilon;': '\u03f5',
2157 'varkappa;': '\u03f0',
2158 'varnothing;': '\u2205',
2159 'varphi;': '\u03d5',
2160 'varpi;': '\u03d6',
2161 'varpropto;': '\u221d',
2162 'vArr;': '\u21d5',
2163 'varr;': '\u2195',
2164 'varrho;': '\u03f1',
2165 'varsigma;': '\u03c2',
2166 'varsubsetneq;': '\u228a\ufe00',
2167 'varsubsetneqq;': '\u2acb\ufe00',
2168 'varsupsetneq;': '\u228b\ufe00',
2169 'varsupsetneqq;': '\u2acc\ufe00',
2170 'vartheta;': '\u03d1',
2171 'vartriangleleft;': '\u22b2',
2172 'vartriangleright;': '\u22b3',
2173 'Vbar;': '\u2aeb',
2174 'vBar;': '\u2ae8',
2175 'vBarv;': '\u2ae9',
2176 'Vcy;': '\u0412',
2177 'vcy;': '\u0432',
2178 'VDash;': '\u22ab',
2179 'Vdash;': '\u22a9',
2180 'vDash;': '\u22a8',
2181 'vdash;': '\u22a2',
2182 'Vdashl;': '\u2ae6',
2183 'Vee;': '\u22c1',
2184 'vee;': '\u2228',
2185 'veebar;': '\u22bb',
2186 'veeeq;': '\u225a',
2187 'vellip;': '\u22ee',
2188 'Verbar;': '\u2016',
2189 'verbar;': '|',
2190 'Vert;': '\u2016',
2191 'vert;': '|',
2192 'VerticalBar;': '\u2223',
2193 'VerticalLine;': '|',
2194 'VerticalSeparator;': '\u2758',
2195 'VerticalTilde;': '\u2240',
2196 'VeryThinSpace;': '\u200a',
2197 'Vfr;': '\U0001d519',
2198 'vfr;': '\U0001d533',
2199 'vltri;': '\u22b2',
2200 'vnsub;': '\u2282\u20d2',
2201 'vnsup;': '\u2283\u20d2',
2202 'Vopf;': '\U0001d54d',
2203 'vopf;': '\U0001d567',
2204 'vprop;': '\u221d',
2205 'vrtri;': '\u22b3',
2206 'Vscr;': '\U0001d4b1',
2207 'vscr;': '\U0001d4cb',
2208 'vsubnE;': '\u2acb\ufe00',
2209 'vsubne;': '\u228a\ufe00',
2210 'vsupnE;': '\u2acc\ufe00',
2211 'vsupne;': '\u228b\ufe00',
2212 'Vvdash;': '\u22aa',
2213 'vzigzag;': '\u299a',
2214 'Wcirc;': '\u0174',
2215 'wcirc;': '\u0175',
2216 'wedbar;': '\u2a5f',
2217 'Wedge;': '\u22c0',
2218 'wedge;': '\u2227',
2219 'wedgeq;': '\u2259',
2220 'weierp;': '\u2118',
2221 'Wfr;': '\U0001d51a',
2222 'wfr;': '\U0001d534',
2223 'Wopf;': '\U0001d54e',
2224 'wopf;': '\U0001d568',
2225 'wp;': '\u2118',
2226 'wr;': '\u2240',
2227 'wreath;': '\u2240',
2228 'Wscr;': '\U0001d4b2',
2229 'wscr;': '\U0001d4cc',
2230 'xcap;': '\u22c2',
2231 'xcirc;': '\u25ef',
2232 'xcup;': '\u22c3',
2233 'xdtri;': '\u25bd',
2234 'Xfr;': '\U0001d51b',
2235 'xfr;': '\U0001d535',
2236 'xhArr;': '\u27fa',
2237 'xharr;': '\u27f7',
2238 'Xi;': '\u039e',
2239 'xi;': '\u03be',
2240 'xlArr;': '\u27f8',
2241 'xlarr;': '\u27f5',
2242 'xmap;': '\u27fc',
2243 'xnis;': '\u22fb',
2244 'xodot;': '\u2a00',
2245 'Xopf;': '\U0001d54f',
2246 'xopf;': '\U0001d569',
2247 'xoplus;': '\u2a01',
2248 'xotime;': '\u2a02',
2249 'xrArr;': '\u27f9',
2250 'xrarr;': '\u27f6',
2251 'Xscr;': '\U0001d4b3',
2252 'xscr;': '\U0001d4cd',
2253 'xsqcup;': '\u2a06',
2254 'xuplus;': '\u2a04',
2255 'xutri;': '\u25b3',
2256 'xvee;': '\u22c1',
2257 'xwedge;': '\u22c0',
2258 'Yacute': '\xdd',
2259 'yacute': '\xfd',
2260 'Yacute;': '\xdd',
2261 'yacute;': '\xfd',
2262 'YAcy;': '\u042f',
2263 'yacy;': '\u044f',
2264 'Ycirc;': '\u0176',
2265 'ycirc;': '\u0177',
2266 'Ycy;': '\u042b',
2267 'ycy;': '\u044b',
2268 'yen': '\xa5',
2269 'yen;': '\xa5',
2270 'Yfr;': '\U0001d51c',
2271 'yfr;': '\U0001d536',
2272 'YIcy;': '\u0407',
2273 'yicy;': '\u0457',
2274 'Yopf;': '\U0001d550',
2275 'yopf;': '\U0001d56a',
2276 'Yscr;': '\U0001d4b4',
2277 'yscr;': '\U0001d4ce',
2278 'YUcy;': '\u042e',
2279 'yucy;': '\u044e',
2280 'yuml': '\xff',
2281 'Yuml;': '\u0178',
2282 'yuml;': '\xff',
2283 'Zacute;': '\u0179',
2284 'zacute;': '\u017a',
2285 'Zcaron;': '\u017d',
2286 'zcaron;': '\u017e',
2287 'Zcy;': '\u0417',
2288 'zcy;': '\u0437',
2289 'Zdot;': '\u017b',
2290 'zdot;': '\u017c',
2291 'zeetrf;': '\u2128',
2292 'ZeroWidthSpace;': '\u200b',
2293 'Zeta;': '\u0396',
2294 'zeta;': '\u03b6',
2295 'Zfr;': '\u2128',
2296 'zfr;': '\U0001d537',
2297 'ZHcy;': '\u0416',
2298 'zhcy;': '\u0436',
2299 'zigrarr;': '\u21dd',
2300 'Zopf;': '\u2124',
2301 'zopf;': '\U0001d56b',
2302 'Zscr;': '\U0001d4b5',
2303 'zscr;': '\U0001d4cf',
2304 'zwj;': '\u200d',
2305 'zwnj;': '\u200c',
2306 }
2307
2308 try:
2309 import http.client as compat_http_client
2310 except ImportError: # Python 2
2311 import httplib as compat_http_client
2312
2313 try:
2314 from urllib.error import HTTPError as compat_HTTPError
2315 except ImportError: # Python 2
2316 from urllib2 import HTTPError as compat_HTTPError
2317
2318 try:
2319 from urllib.request import urlretrieve as compat_urlretrieve
2320 except ImportError: # Python 2
2321 from urllib import urlretrieve as compat_urlretrieve
2322
2323 try:
2324 from html.parser import HTMLParser as compat_HTMLParser
2325 except ImportError: # Python 2
2326 from HTMLParser import HTMLParser as compat_HTMLParser
2327
2328 try: # Python 2
2329 from HTMLParser import HTMLParseError as compat_HTMLParseError
2330 except ImportError: # Python <3.4
2331 try:
2332 from html.parser import HTMLParseError as compat_HTMLParseError
2333 except ImportError: # Python >3.4
2334
2335 # HTMLParseError has been deprecated in Python 3.3 and removed in
2336 # Python 3.5. Introducing dummy exception for Python >3.5 for compatible
2337 # and uniform cross-version exceptiong handling
2338 class compat_HTMLParseError(Exception):
2339 pass
2340
2341 try:
2342 from subprocess import DEVNULL
2343 compat_subprocess_get_DEVNULL = lambda: DEVNULL
2344 except ImportError:
2345 compat_subprocess_get_DEVNULL = lambda: open(os.path.devnull, 'w')
2346
2347 try:
2348 import http.server as compat_http_server
2349 except ImportError:
2350 import BaseHTTPServer as compat_http_server
2351
2352 try:
2353 compat_str = unicode # Python 2
2354 except NameError:
2355 compat_str = str
2356
2357 try:
2358 from urllib.parse import unquote_to_bytes as compat_urllib_parse_unquote_to_bytes
2359 from urllib.parse import unquote as compat_urllib_parse_unquote
2360 from urllib.parse import unquote_plus as compat_urllib_parse_unquote_plus
2361 except ImportError: # Python 2
2362 _asciire = (compat_urllib_parse._asciire if hasattr(compat_urllib_parse, '_asciire')
2363 else re.compile(r'([\x00-\x7f]+)'))
2364
2365 # HACK: The following are the correct unquote_to_bytes, unquote and unquote_plus
2366 # implementations from cpython 3.4.3's stdlib. Python 2's version
2367 # is apparently broken (see https://github.com/ytdl-org/youtube-dl/pull/6244)
2368
2369 def compat_urllib_parse_unquote_to_bytes(string):
2370 """unquote_to_bytes('abc%20def') -> b'abc def'."""
2371 # Note: strings are encoded as UTF-8. This is only an issue if it contains
2372 # unescaped non-ASCII characters, which URIs should not.
2373 if not string:
2374 # Is it a string-like object?
2375 string.split
2376 return b''
2377 if isinstance(string, compat_str):
2378 string = string.encode('utf-8')
2379 bits = string.split(b'%')
2380 if len(bits) == 1:
2381 return string
2382 res = [bits[0]]
2383 append = res.append
2384 for item in bits[1:]:
2385 try:
2386 append(compat_urllib_parse._hextochr[item[:2]])
2387 append(item[2:])
2388 except KeyError:
2389 append(b'%')
2390 append(item)
2391 return b''.join(res)
2392
2393 def compat_urllib_parse_unquote(string, encoding='utf-8', errors='replace'):
2394 """Replace %xx escapes by their single-character equivalent. The optional
2395 encoding and errors parameters specify how to decode percent-encoded
2396 sequences into Unicode characters, as accepted by the bytes.decode()
2397 method.
2398 By default, percent-encoded sequences are decoded with UTF-8, and invalid
2399 sequences are replaced by a placeholder character.
2400
2401 unquote('abc%20def') -> 'abc def'.
2402 """
2403 if '%' not in string:
2404 string.split
2405 return string
2406 if encoding is None:
2407 encoding = 'utf-8'
2408 if errors is None:
2409 errors = 'replace'
2410 bits = _asciire.split(string)
2411 res = [bits[0]]
2412 append = res.append
2413 for i in range(1, len(bits), 2):
2414 append(compat_urllib_parse_unquote_to_bytes(bits[i]).decode(encoding, errors))
2415 append(bits[i + 1])
2416 return ''.join(res)
2417
2418 def compat_urllib_parse_unquote_plus(string, encoding='utf-8', errors='replace'):
2419 """Like unquote(), but also replace plus signs by spaces, as required for
2420 unquoting HTML form values.
2421
2422 unquote_plus('%7e/abc+def') -> '~/abc def'
2423 """
2424 string = string.replace('+', ' ')
2425 return compat_urllib_parse_unquote(string, encoding, errors)
2426
2427 try:
2428 from urllib.parse import urlencode as compat_urllib_parse_urlencode
2429 except ImportError: # Python 2
2430 # Python 2 will choke in urlencode on mixture of byte and unicode strings.
2431 # Possible solutions are to either port it from python 3 with all
2432 # the friends or manually ensure input query contains only byte strings.
2433 # We will stick with latter thus recursively encoding the whole query.
2434 def compat_urllib_parse_urlencode(query, doseq=0, encoding='utf-8'):
2435 def encode_elem(e):
2436 if isinstance(e, dict):
2437 e = encode_dict(e)
2438 elif isinstance(e, (list, tuple,)):
2439 list_e = encode_list(e)
2440 e = tuple(list_e) if isinstance(e, tuple) else list_e
2441 elif isinstance(e, compat_str):
2442 e = e.encode(encoding)
2443 return e
2444
2445 def encode_dict(d):
2446 return dict((encode_elem(k), encode_elem(v)) for k, v in d.items())
2447
2448 def encode_list(l):
2449 return [encode_elem(e) for e in l]
2450
2451 return compat_urllib_parse.urlencode(encode_elem(query), doseq=doseq)
2452
2453 try:
2454 from urllib.request import DataHandler as compat_urllib_request_DataHandler
2455 except ImportError: # Python < 3.4
2456 # Ported from CPython 98774:1733b3bd46db, Lib/urllib/request.py
2457 class compat_urllib_request_DataHandler(compat_urllib_request.BaseHandler):
2458 def data_open(self, req):
2459 # data URLs as specified in RFC 2397.
2460 #
2461 # ignores POSTed data
2462 #
2463 # syntax:
2464 # dataurl := "data:" [ mediatype ] [ ";base64" ] "," data
2465 # mediatype := [ type "/" subtype ] *( ";" parameter )
2466 # data := *urlchar
2467 # parameter := attribute "=" value
2468 url = req.get_full_url()
2469
2470 scheme, data = url.split(':', 1)
2471 mediatype, data = data.split(',', 1)
2472
2473 # even base64 encoded data URLs might be quoted so unquote in any case:
2474 data = compat_urllib_parse_unquote_to_bytes(data)
2475 if mediatype.endswith(';base64'):
2476 data = binascii.a2b_base64(data)
2477 mediatype = mediatype[:-7]
2478
2479 if not mediatype:
2480 mediatype = 'text/plain;charset=US-ASCII'
2481
2482 headers = email.message_from_string(
2483 'Content-type: %s\nContent-length: %d\n' % (mediatype, len(data)))
2484
2485 return compat_urllib_response.addinfourl(io.BytesIO(data), headers, url)
2486
2487 try:
2488 compat_basestring = basestring # Python 2
2489 except NameError:
2490 compat_basestring = str
2491
2492 try:
2493 compat_chr = unichr # Python 2
2494 except NameError:
2495 compat_chr = chr
2496
2497 try:
2498 from xml.etree.ElementTree import ParseError as compat_xml_parse_error
2499 except ImportError: # Python 2.6
2500 from xml.parsers.expat import ExpatError as compat_xml_parse_error
2501
2502
2503 etree = xml.etree.ElementTree
2504
2505
2506 class _TreeBuilder(etree.TreeBuilder):
2507 def doctype(self, name, pubid, system):
2508 pass
2509
2510
2511 try:
2512 # xml.etree.ElementTree.Element is a method in Python <=2.6 and
2513 # the following will crash with:
2514 # TypeError: isinstance() arg 2 must be a class, type, or tuple of classes and types
2515 isinstance(None, xml.etree.ElementTree.Element)
2516 from xml.etree.ElementTree import Element as compat_etree_Element
2517 except TypeError: # Python <=2.6
2518 from xml.etree.ElementTree import _ElementInterface as compat_etree_Element
2519
2520 if sys.version_info[0] >= 3:
2521 def compat_etree_fromstring(text):
2522 return etree.XML(text, parser=etree.XMLParser(target=_TreeBuilder()))
2523 else:
2524 # python 2.x tries to encode unicode strings with ascii (see the
2525 # XMLParser._fixtext method)
2526 try:
2527 _etree_iter = etree.Element.iter
2528 except AttributeError: # Python <=2.6
2529 def _etree_iter(root):
2530 for el in root.findall('*'):
2531 yield el
2532 for sub in _etree_iter(el):
2533 yield sub
2534
2535 # on 2.6 XML doesn't have a parser argument, function copied from CPython
2536 # 2.7 source
2537 def _XML(text, parser=None):
2538 if not parser:
2539 parser = etree.XMLParser(target=_TreeBuilder())
2540 parser.feed(text)
2541 return parser.close()
2542
2543 def _element_factory(*args, **kwargs):
2544 el = etree.Element(*args, **kwargs)
2545 for k, v in el.items():
2546 if isinstance(v, bytes):
2547 el.set(k, v.decode('utf-8'))
2548 return el
2549
2550 def compat_etree_fromstring(text):
2551 doc = _XML(text, parser=etree.XMLParser(target=_TreeBuilder(element_factory=_element_factory)))
2552 for el in _etree_iter(doc):
2553 if el.text is not None and isinstance(el.text, bytes):
2554 el.text = el.text.decode('utf-8')
2555 return doc
2556
2557 if hasattr(etree, 'register_namespace'):
2558 compat_etree_register_namespace = etree.register_namespace
2559 else:
2560 def compat_etree_register_namespace(prefix, uri):
2561 """Register a namespace prefix.
2562 The registry is global, and any existing mapping for either the
2563 given prefix or the namespace URI will be removed.
2564 *prefix* is the namespace prefix, *uri* is a namespace uri. Tags and
2565 attributes in this namespace will be serialized with prefix if possible.
2566 ValueError is raised if prefix is reserved or is invalid.
2567 """
2568 if re.match(r"ns\d+$", prefix):
2569 raise ValueError("Prefix format reserved for internal use")
2570 for k, v in list(etree._namespace_map.items()):
2571 if k == uri or v == prefix:
2572 del etree._namespace_map[k]
2573 etree._namespace_map[uri] = prefix
2574
2575 if sys.version_info < (2, 7):
2576 # Here comes the crazy part: In 2.6, if the xpath is a unicode,
2577 # .//node does not match if a node is a direct child of . !
2578 def compat_xpath(xpath):
2579 if isinstance(xpath, compat_str):
2580 xpath = xpath.encode('ascii')
2581 return xpath
2582 else:
2583 compat_xpath = lambda xpath: xpath
2584
2585 try:
2586 from urllib.parse import parse_qs as compat_parse_qs
2587 except ImportError: # Python 2
2588 # HACK: The following is the correct parse_qs implementation from cpython 3's stdlib.
2589 # Python 2's version is apparently totally broken
2590
2591 def _parse_qsl(qs, keep_blank_values=False, strict_parsing=False,
2592 encoding='utf-8', errors='replace'):
2593 qs, _coerce_result = qs, compat_str
2594 pairs = [s2 for s1 in qs.split('&') for s2 in s1.split(';')]
2595 r = []
2596 for name_value in pairs:
2597 if not name_value and not strict_parsing:
2598 continue
2599 nv = name_value.split('=', 1)
2600 if len(nv) != 2:
2601 if strict_parsing:
2602 raise ValueError('bad query field: %r' % (name_value,))
2603 # Handle case of a control-name with no equal sign
2604 if keep_blank_values:
2605 nv.append('')
2606 else:
2607 continue
2608 if len(nv[1]) or keep_blank_values:
2609 name = nv[0].replace('+', ' ')
2610 name = compat_urllib_parse_unquote(
2611 name, encoding=encoding, errors=errors)
2612 name = _coerce_result(name)
2613 value = nv[1].replace('+', ' ')
2614 value = compat_urllib_parse_unquote(
2615 value, encoding=encoding, errors=errors)
2616 value = _coerce_result(value)
2617 r.append((name, value))
2618 return r
2619
2620 def compat_parse_qs(qs, keep_blank_values=False, strict_parsing=False,
2621 encoding='utf-8', errors='replace'):
2622 parsed_result = {}
2623 pairs = _parse_qsl(qs, keep_blank_values, strict_parsing,
2624 encoding=encoding, errors=errors)
2625 for name, value in pairs:
2626 if name in parsed_result:
2627 parsed_result[name].append(value)
2628 else:
2629 parsed_result[name] = [value]
2630 return parsed_result
2631
2632
2633 compat_os_name = os._name if os.name == 'java' else os.name
2634
2635
2636 if compat_os_name == 'nt':
2637 def compat_shlex_quote(s):
2638 return s if re.match(r'^[-_\w./]+$', s) else '"%s"' % s.replace('"', '\\"')
2639 else:
2640 try:
2641 from shlex import quote as compat_shlex_quote
2642 except ImportError: # Python < 3.3
2643 def compat_shlex_quote(s):
2644 if re.match(r'^[-_\w./]+$', s):
2645 return s
2646 else:
2647 return "'" + s.replace("'", "'\"'\"'") + "'"
2648
2649
2650 try:
2651 args = shlex.split('äø­ę–‡')
2652 assert (isinstance(args, list)
2653 and isinstance(args[0], compat_str)
2654 and args[0] == 'äø­ę–‡')
2655 compat_shlex_split = shlex.split
2656 except (AssertionError, UnicodeEncodeError):
2657 # Working around shlex issue with unicode strings on some python 2
2658 # versions (see http://bugs.python.org/issue1548891)
2659 def compat_shlex_split(s, comments=False, posix=True):
2660 if isinstance(s, compat_str):
2661 s = s.encode('utf-8')
2662 return list(map(lambda s: s.decode('utf-8'), shlex.split(s, comments, posix)))
2663
2664
2665 def compat_ord(c):
2666 if type(c) is int:
2667 return c
2668 else:
2669 return ord(c)
2670
2671
2672 if sys.version_info >= (3, 0):
2673 compat_getenv = os.getenv
2674 compat_expanduser = os.path.expanduser
2675
2676 def compat_setenv(key, value, env=os.environ):
2677 env[key] = value
2678 else:
2679 # Environment variables should be decoded with filesystem encoding.
2680 # Otherwise it will fail if any non-ASCII characters present (see #3854 #3217 #2918)
2681
2682 def compat_getenv(key, default=None):
2683 from .utils import get_filesystem_encoding
2684 env = os.getenv(key, default)
2685 if env:
2686 env = env.decode(get_filesystem_encoding())
2687 return env
2688
2689 def compat_setenv(key, value, env=os.environ):
2690 def encode(v):
2691 from .utils import get_filesystem_encoding
2692 return v.encode(get_filesystem_encoding()) if isinstance(v, compat_str) else v
2693 env[encode(key)] = encode(value)
2694
2695 # HACK: The default implementations of os.path.expanduser from cpython do not decode
2696 # environment variables with filesystem encoding. We will work around this by
2697 # providing adjusted implementations.
2698 # The following are os.path.expanduser implementations from cpython 2.7.8 stdlib
2699 # for different platforms with correct environment variables decoding.
2700
2701 if compat_os_name == 'posix':
2702 def compat_expanduser(path):
2703 """Expand ~ and ~user constructions. If user or $HOME is unknown,
2704 do nothing."""
2705 if not path.startswith('~'):
2706 return path
2707 i = path.find('/', 1)
2708 if i < 0:
2709 i = len(path)
2710 if i == 1:
2711 if 'HOME' not in os.environ:
2712 import pwd
2713 userhome = pwd.getpwuid(os.getuid()).pw_dir
2714 else:
2715 userhome = compat_getenv('HOME')
2716 else:
2717 import pwd
2718 try:
2719 pwent = pwd.getpwnam(path[1:i])
2720 except KeyError:
2721 return path
2722 userhome = pwent.pw_dir
2723 userhome = userhome.rstrip('/')
2724 return (userhome + path[i:]) or '/'
2725 elif compat_os_name in ('nt', 'ce'):
2726 def compat_expanduser(path):
2727 """Expand ~ and ~user constructs.
2728
2729 If user or $HOME is unknown, do nothing."""
2730 if path[:1] != '~':
2731 return path
2732 i, n = 1, len(path)
2733 while i < n and path[i] not in '/\\':
2734 i = i + 1
2735
2736 if 'HOME' in os.environ:
2737 userhome = compat_getenv('HOME')
2738 elif 'USERPROFILE' in os.environ:
2739 userhome = compat_getenv('USERPROFILE')
2740 elif 'HOMEPATH' not in os.environ:
2741 return path
2742 else:
2743 try:
2744 drive = compat_getenv('HOMEDRIVE')
2745 except KeyError:
2746 drive = ''
2747 userhome = os.path.join(drive, compat_getenv('HOMEPATH'))
2748
2749 if i != 1: # ~user
2750 userhome = os.path.join(os.path.dirname(userhome), path[1:i])
2751
2752 return userhome + path[i:]
2753 else:
2754 compat_expanduser = os.path.expanduser
2755
2756
2757 if sys.version_info < (3, 0):
2758 def compat_print(s):
2759 from .utils import preferredencoding
2760 print(s.encode(preferredencoding(), 'xmlcharrefreplace'))
2761 else:
2762 def compat_print(s):
2763 assert isinstance(s, compat_str)
2764 print(s)
2765
2766
2767 if sys.version_info < (3, 0) and sys.platform == 'win32':
2768 def compat_getpass(prompt, *args, **kwargs):
2769 if isinstance(prompt, compat_str):
2770 from .utils import preferredencoding
2771 prompt = prompt.encode(preferredencoding())
2772 return getpass.getpass(prompt, *args, **kwargs)
2773 else:
2774 compat_getpass = getpass.getpass
2775
2776 try:
2777 compat_input = raw_input
2778 except NameError: # Python 3
2779 compat_input = input
2780
2781 # Python < 2.6.5 require kwargs to be bytes
2782 try:
2783 def _testfunc(x):
2784 pass
2785 _testfunc(**{'x': 0})
2786 except TypeError:
2787 def compat_kwargs(kwargs):
2788 return dict((bytes(k), v) for k, v in kwargs.items())
2789 else:
2790 compat_kwargs = lambda kwargs: kwargs
2791
2792
2793 try:
2794 compat_numeric_types = (int, float, long, complex)
2795 except NameError: # Python 3
2796 compat_numeric_types = (int, float, complex)
2797
2798
2799 try:
2800 compat_integer_types = (int, long)
2801 except NameError: # Python 3
2802 compat_integer_types = (int, )
2803
2804
2805 if sys.version_info < (2, 7):
2806 def compat_socket_create_connection(address, timeout, source_address=None):
2807 host, port = address
2808 err = None
2809 for res in socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM):
2810 af, socktype, proto, canonname, sa = res
2811 sock = None
2812 try:
2813 sock = socket.socket(af, socktype, proto)
2814 sock.settimeout(timeout)
2815 if source_address:
2816 sock.bind(source_address)
2817 sock.connect(sa)
2818 return sock
2819 except socket.error as _:
2820 err = _
2821 if sock is not None:
2822 sock.close()
2823 if err is not None:
2824 raise err
2825 else:
2826 raise socket.error('getaddrinfo returns an empty list')
2827 else:
2828 compat_socket_create_connection = socket.create_connection
2829
2830
2831 # Fix https://github.com/ytdl-org/youtube-dl/issues/4223
2832 # See http://bugs.python.org/issue9161 for what is broken
2833 def workaround_optparse_bug9161():
2834 op = optparse.OptionParser()
2835 og = optparse.OptionGroup(op, 'foo')
2836 try:
2837 og.add_option('-t')
2838 except TypeError:
2839 real_add_option = optparse.OptionGroup.add_option
2840
2841 def _compat_add_option(self, *args, **kwargs):
2842 enc = lambda v: (
2843 v.encode('ascii', 'replace') if isinstance(v, compat_str)
2844 else v)
2845 bargs = [enc(a) for a in args]
2846 bkwargs = dict(
2847 (k, enc(v)) for k, v in kwargs.items())
2848 return real_add_option(self, *bargs, **bkwargs)
2849 optparse.OptionGroup.add_option = _compat_add_option
2850
2851
2852 if hasattr(shutil, 'get_terminal_size'): # Python >= 3.3
2853 compat_get_terminal_size = shutil.get_terminal_size
2854 else:
2855 _terminal_size = collections.namedtuple('terminal_size', ['columns', 'lines'])
2856
2857 def compat_get_terminal_size(fallback=(80, 24)):
2858 columns = compat_getenv('COLUMNS')
2859 if columns:
2860 columns = int(columns)
2861 else:
2862 columns = None
2863 lines = compat_getenv('LINES')
2864 if lines:
2865 lines = int(lines)
2866 else:
2867 lines = None
2868
2869 if columns is None or lines is None or columns <= 0 or lines <= 0:
2870 try:
2871 sp = subprocess.Popen(
2872 ['stty', 'size'],
2873 stdout=subprocess.PIPE, stderr=subprocess.PIPE)
2874 out, err = sp.communicate()
2875 _lines, _columns = map(int, out.split())
2876 except Exception:
2877 _columns, _lines = _terminal_size(*fallback)
2878
2879 if columns is None or columns <= 0:
2880 columns = _columns
2881 if lines is None or lines <= 0:
2882 lines = _lines
2883 return _terminal_size(columns, lines)
2884
2885 try:
2886 itertools.count(start=0, step=1)
2887 compat_itertools_count = itertools.count
2888 except TypeError: # Python 2.6
2889 def compat_itertools_count(start=0, step=1):
2890 n = start
2891 while True:
2892 yield n
2893 n += step
2894
2895 if sys.version_info >= (3, 0):
2896 from tokenize import tokenize as compat_tokenize_tokenize
2897 else:
2898 from tokenize import generate_tokens as compat_tokenize_tokenize
2899
2900
2901 try:
2902 struct.pack('!I', 0)
2903 except TypeError:
2904 # In Python 2.6 and 2.7.x < 2.7.7, struct requires a bytes argument
2905 # See https://bugs.python.org/issue19099
2906 def compat_struct_pack(spec, *args):
2907 if isinstance(spec, compat_str):
2908 spec = spec.encode('ascii')
2909 return struct.pack(spec, *args)
2910
2911 def compat_struct_unpack(spec, *args):
2912 if isinstance(spec, compat_str):
2913 spec = spec.encode('ascii')
2914 return struct.unpack(spec, *args)
2915
2916 class compat_Struct(struct.Struct):
2917 def __init__(self, fmt):
2918 if isinstance(fmt, compat_str):
2919 fmt = fmt.encode('ascii')
2920 super(compat_Struct, self).__init__(fmt)
2921 else:
2922 compat_struct_pack = struct.pack
2923 compat_struct_unpack = struct.unpack
2924 if platform.python_implementation() == 'IronPython' and sys.version_info < (2, 7, 8):
2925 class compat_Struct(struct.Struct):
2926 def unpack(self, string):
2927 if not isinstance(string, buffer): # noqa: F821
2928 string = buffer(string) # noqa: F821
2929 return super(compat_Struct, self).unpack(string)
2930 else:
2931 compat_Struct = struct.Struct
2932
2933
2934 try:
2935 from future_builtins import zip as compat_zip
2936 except ImportError: # not 2.6+ or is 3.x
2937 try:
2938 from itertools import izip as compat_zip # < 2.5 or 3.x
2939 except ImportError:
2940 compat_zip = zip
2941
2942
2943 if sys.version_info < (3, 3):
2944 def compat_b64decode(s, *args, **kwargs):
2945 if isinstance(s, compat_str):
2946 s = s.encode('ascii')
2947 return base64.b64decode(s, *args, **kwargs)
2948 else:
2949 compat_b64decode = base64.b64decode
2950
2951
2952 if platform.python_implementation() == 'PyPy' and sys.pypy_version_info < (5, 4, 0):
2953 # PyPy2 prior to version 5.4.0 expects byte strings as Windows function
2954 # names, see the original PyPy issue [1] and the youtube-dl one [2].
2955 # 1. https://bitbucket.org/pypy/pypy/issues/2360/windows-ctypescdll-typeerror-function-name
2956 # 2. https://github.com/ytdl-org/youtube-dl/pull/4392
2957 def compat_ctypes_WINFUNCTYPE(*args, **kwargs):
2958 real = ctypes.WINFUNCTYPE(*args, **kwargs)
2959
2960 def resf(tpl, *args, **kwargs):
2961 funcname, dll = tpl
2962 return real((str(funcname), dll), *args, **kwargs)
2963
2964 return resf
2965 else:
2966 def compat_ctypes_WINFUNCTYPE(*args, **kwargs):
2967 return ctypes.WINFUNCTYPE(*args, **kwargs)
2968
2969
2970 __all__ = [
2971 'compat_HTMLParseError',
2972 'compat_HTMLParser',
2973 'compat_HTTPError',
2974 'compat_Struct',
2975 'compat_b64decode',
2976 'compat_basestring',
2977 'compat_chr',
2978 'compat_cookiejar',
2979 'compat_cookies',
2980 'compat_ctypes_WINFUNCTYPE',
2981 'compat_etree_Element',
2982 'compat_etree_fromstring',
2983 'compat_etree_register_namespace',
2984 'compat_expanduser',
2985 'compat_get_terminal_size',
2986 'compat_getenv',
2987 'compat_getpass',
2988 'compat_html_entities',
2989 'compat_html_entities_html5',
2990 'compat_http_client',
2991 'compat_http_server',
2992 'compat_input',
2993 'compat_integer_types',
2994 'compat_itertools_count',
2995 'compat_kwargs',
2996 'compat_numeric_types',
2997 'compat_ord',
2998 'compat_os_name',
2999 'compat_parse_qs',
3000 'compat_print',
3001 'compat_setenv',
3002 'compat_shlex_quote',
3003 'compat_shlex_split',
3004 'compat_socket_create_connection',
3005 'compat_str',
3006 'compat_struct_pack',
3007 'compat_struct_unpack',
3008 'compat_subprocess_get_DEVNULL',
3009 'compat_tokenize_tokenize',
3010 'compat_urllib_error',
3011 'compat_urllib_parse',
3012 'compat_urllib_parse_unquote',
3013 'compat_urllib_parse_unquote_plus',
3014 'compat_urllib_parse_unquote_to_bytes',
3015 'compat_urllib_parse_urlencode',
3016 'compat_urllib_parse_urlparse',
3017 'compat_urllib_request',
3018 'compat_urllib_request_DataHandler',
3019 'compat_urllib_response',
3020 'compat_urlparse',
3021 'compat_urlretrieve',
3022 'compat_xml_parse_error',
3023 'compat_xpath',
3024 'compat_zip',
3025 'workaround_optparse_bug9161',
3026 ]