1//! Manage xml character escapes
2
3use memchr::memchr2_iter;
4use std::borrow::Cow;
5use std::ops::Range;
6
7#[cfg(test)]
8use pretty_assertions::assert_eq;
9
10/// Error for XML escape / unescape.
11#[derive(Clone, Debug)]
12pub enum EscapeError {
13 /// Entity with Null character
14 EntityWithNull(Range<usize>),
15 /// Unrecognized escape symbol
16 UnrecognizedSymbol(Range<usize>, String),
17 /// Cannot find `;` after `&`
18 UnterminatedEntity(Range<usize>),
19 /// Cannot convert Hexa to utf8
20 TooLongHexadecimal,
21 /// Character is not a valid hexadecimal value
22 InvalidHexadecimal(char),
23 /// Cannot convert decimal to hexa
24 TooLongDecimal,
25 /// Character is not a valid decimal value
26 InvalidDecimal(char),
27 /// Not a valid unicode codepoint
28 InvalidCodepoint(u32),
29}
30
31impl std::fmt::Display for EscapeError {
32 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
33 match self {
34 EscapeError::EntityWithNull(e) => write!(
35 f,
36 "Error while escaping character at range {:?}: Null character entity not allowed",
37 e
38 ),
39 EscapeError::UnrecognizedSymbol(rge, res) => write!(
40 f,
41 "Error while escaping character at range {:?}: Unrecognized escape symbol: {:?}",
42 rge, res
43 ),
44 EscapeError::UnterminatedEntity(e) => write!(
45 f,
46 "Error while escaping character at range {:?}: Cannot find ';' after '&'",
47 e
48 ),
49 EscapeError::TooLongHexadecimal => write!(f, "Cannot convert hexadecimal to utf8"),
50 EscapeError::InvalidHexadecimal(e) => {
51 write!(f, "'{}' is not a valid hexadecimal character", e)
52 }
53 EscapeError::TooLongDecimal => write!(f, "Cannot convert decimal to utf8"),
54 EscapeError::InvalidDecimal(e) => write!(f, "'{}' is not a valid decimal character", e),
55 EscapeError::InvalidCodepoint(n) => write!(f, "'{}' is not a valid codepoint", n),
56 }
57 }
58}
59
60impl std::error::Error for EscapeError {}
61
62/// Escapes an `&str` and replaces all xml special characters (`<`, `>`, `&`, `'`, `"`)
63/// with their corresponding xml escaped value.
64///
65/// This function performs following replacements:
66///
67/// | Character | Replacement
68/// |-----------|------------
69/// | `<` | `&lt;`
70/// | `>` | `&gt;`
71/// | `&` | `&amp;`
72/// | `'` | `&apos;`
73/// | `"` | `&quot;`
74pub fn escape(raw: &str) -> Cow<str> {
75 _escape(raw, |ch: u8| matches!(ch, b'<' | b'>' | b'&' | b'\'' | b'\"'))
76}
77
78/// Escapes an `&str` and replaces xml special characters (`<`, `>`, `&`)
79/// with their corresponding xml escaped value.
80///
81/// Should only be used for escaping text content. In XML text content, it is allowed
82/// (though not recommended) to leave the quote special characters `"` and `'` unescaped.
83///
84/// This function performs following replacements:
85///
86/// | Character | Replacement
87/// |-----------|------------
88/// | `<` | `&lt;`
89/// | `>` | `&gt;`
90/// | `&` | `&amp;`
91pub fn partial_escape(raw: &str) -> Cow<str> {
92 _escape(raw, |ch: u8| matches!(ch, b'<' | b'>' | b'&'))
93}
94
95/// Escapes an `&str` and replaces a subset of xml special characters (`<`, `>`,
96/// `&`, `'`, `"`) with their corresponding xml escaped value.
97pub(crate) fn _escape<F: Fn(u8) -> bool>(raw: &str, escape_chars: F) -> Cow<str> {
98 let bytes = raw.as_bytes();
99 let mut escaped = None;
100 let mut iter = bytes.iter();
101 let mut pos = 0;
102 while let Some(i) = iter.position(|&b| escape_chars(b)) {
103 if escaped.is_none() {
104 escaped = Some(Vec::with_capacity(raw.len()));
105 }
106 let escaped = escaped.as_mut().expect("initialized");
107 let new_pos = pos + i;
108 escaped.extend_from_slice(&bytes[pos..new_pos]);
109 match bytes[new_pos] {
110 b'<' => escaped.extend_from_slice(b"&lt;"),
111 b'>' => escaped.extend_from_slice(b"&gt;"),
112 b'\'' => escaped.extend_from_slice(b"&apos;"),
113 b'&' => escaped.extend_from_slice(b"&amp;"),
114 b'"' => escaped.extend_from_slice(b"&quot;"),
115
116 // This set of escapes handles characters that should be escaped
117 // in elements of xs:lists, because those characters works as
118 // delimiters of list elements
119 b'\t' => escaped.extend_from_slice(b"&#9;"),
120 b'\n' => escaped.extend_from_slice(b"&#10;"),
121 b'\r' => escaped.extend_from_slice(b"&#13;"),
122 b' ' => escaped.extend_from_slice(b"&#32;"),
123 _ => unreachable!(
124 "Only '<', '>','\', '&', '\"', '\\t', '\\r', '\\n', and ' ' are escaped"
125 ),
126 }
127 pos = new_pos + 1;
128 }
129
130 if let Some(mut escaped) = escaped {
131 if let Some(raw) = bytes.get(pos..) {
132 escaped.extend_from_slice(raw);
133 }
134 // SAFETY: we operate on UTF-8 input and search for an one byte chars only,
135 // so all slices that was put to the `escaped` is a valid UTF-8 encoded strings
136 // TODO: Can be replaced with `unsafe { String::from_utf8_unchecked() }`
137 // if unsafe code will be allowed
138 Cow::Owned(String::from_utf8(escaped).unwrap())
139 } else {
140 Cow::Borrowed(raw)
141 }
142}
143
144/// Unescape an `&str` and replaces all xml escaped characters (`&...;`) into
145/// their corresponding value.
146///
147/// If feature [`escape-html`] is enabled, then recognizes all [HTML5 escapes].
148///
149/// [`escape-html`]: ../index.html#escape-html
150/// [HTML5 escapes]: https://dev.w3.org/html5/html-author/charref
151pub fn unescape(raw: &str) -> Result<Cow<str>, EscapeError> {
152 unescape_with(raw, |_| None)
153}
154
155/// Unescape an `&str` and replaces all xml escaped characters (`&...;`) into
156/// their corresponding value, using a resolver function for custom entities.
157///
158/// If feature [`escape-html`] is enabled, then recognizes all [HTML5 escapes].
159///
160/// [`escape-html`]: ../index.html#escape-html
161/// [HTML5 escapes]: https://dev.w3.org/html5/html-author/charref
162pub fn unescape_with<'input, 'entity, F>(
163 raw: &'input str,
164 mut resolve_entity: F,
165) -> Result<Cow<'input, str>, EscapeError>
166where
167 // the lifetime of the output comes from a capture or is `'static`
168 F: FnMut(&str) -> Option<&'entity str>,
169{
170 let bytes = raw.as_bytes();
171 let mut unescaped = None;
172 let mut last_end = 0;
173 let mut iter = memchr2_iter(b'&', b';', bytes);
174 while let Some(start) = iter.by_ref().find(|p| bytes[*p] == b'&') {
175 match iter.next() {
176 Some(end) if bytes[end] == b';' => {
177 // append valid data
178 if unescaped.is_none() {
179 unescaped = Some(String::with_capacity(raw.len()));
180 }
181 let unescaped = unescaped.as_mut().expect("initialized");
182 unescaped.push_str(&raw[last_end..start]);
183
184 // search for character correctness
185 let pat = &raw[start + 1..end];
186 if let Some(entity) = pat.strip_prefix('#') {
187 let codepoint = parse_number(entity, start..end)?;
188 unescaped.push_str(codepoint.encode_utf8(&mut [0u8; 4]));
189 } else if let Some(value) = named_entity(pat) {
190 unescaped.push_str(value);
191 } else if let Some(value) = resolve_entity(pat) {
192 unescaped.push_str(value);
193 } else {
194 return Err(EscapeError::UnrecognizedSymbol(
195 start + 1..end,
196 pat.to_string(),
197 ));
198 }
199
200 last_end = end + 1;
201 }
202 _ => return Err(EscapeError::UnterminatedEntity(start..raw.len())),
203 }
204 }
205
206 if let Some(mut unescaped) = unescaped {
207 if let Some(raw) = raw.get(last_end..) {
208 unescaped.push_str(raw);
209 }
210 Ok(Cow::Owned(unescaped))
211 } else {
212 Ok(Cow::Borrowed(raw))
213 }
214}
215
216#[cfg(not(feature = "escape-html"))]
217fn named_entity(name: &str) -> Option<&str> {
218 // match over strings are not allowed in const functions
219 let s: &str = match name.as_bytes() {
220 b"lt" => "<",
221 b"gt" => ">",
222 b"amp" => "&",
223 b"apos" => "'",
224 b"quot" => "\"",
225 _ => return None,
226 };
227 Some(s)
228}
229#[cfg(feature = "escape-html")]
230fn named_entity(name: &str) -> Option<&str> {
231 // imported from https://dev.w3.org/html5/html-author/charref
232 // match over strings are not allowed in const functions
233 //TODO: automate up-to-dating using https://html.spec.whatwg.org/entities.json
234 let s = match name.as_bytes() {
235 b"Tab" => "\u{09}",
236 b"NewLine" => "\u{0A}",
237 b"excl" => "\u{21}",
238 b"quot" | b"QUOT" => "\u{22}",
239 b"num" => "\u{23}",
240 b"dollar" => "\u{24}",
241 b"percnt" => "\u{25}",
242 b"amp" | b"AMP" => "\u{26}",
243 b"apos" => "\u{27}",
244 b"lpar" => "\u{28}",
245 b"rpar" => "\u{29}",
246 b"ast" | b"midast" => "\u{2A}",
247 b"plus" => "\u{2B}",
248 b"comma" => "\u{2C}",
249 b"period" => "\u{2E}",
250 b"sol" => "\u{2F}",
251 b"colon" => "\u{3A}",
252 b"semi" => "\u{3B}",
253 b"lt" | b"LT" => "\u{3C}",
254 b"equals" => "\u{3D}",
255 b"gt" | b"GT" => "\u{3E}",
256 b"quest" => "\u{3F}",
257 b"commat" => "\u{40}",
258 b"lsqb" | b"lbrack" => "\u{5B}",
259 b"bsol" => "\u{5C}",
260 b"rsqb" | b"rbrack" => "\u{5D}",
261 b"Hat" => "\u{5E}",
262 b"lowbar" => "\u{5F}",
263 b"grave" | b"DiacriticalGrave" => "\u{60}",
264 b"lcub" | b"lbrace" => "\u{7B}",
265 b"verbar" | b"vert" | b"VerticalLine" => "\u{7C}",
266 b"rcub" | b"rbrace" => "\u{7D}",
267 b"nbsp" | b"NonBreakingSpace" => "\u{A0}",
268 b"iexcl" => "\u{A1}",
269 b"cent" => "\u{A2}",
270 b"pound" => "\u{A3}",
271 b"curren" => "\u{A4}",
272 b"yen" => "\u{A5}",
273 b"brvbar" => "\u{A6}",
274 b"sect" => "\u{A7}",
275 b"Dot" | b"die" | b"DoubleDot" | b"uml" => "\u{A8}",
276 b"copy" | b"COPY" => "\u{A9}",
277 b"ordf" => "\u{AA}",
278 b"laquo" => "\u{AB}",
279 b"not" => "\u{AC}",
280 b"shy" => "\u{AD}",
281 b"reg" | b"circledR" | b"REG" => "\u{AE}",
282 b"macr" | b"OverBar" | b"strns" => "\u{AF}",
283 b"deg" => "\u{B0}",
284 b"plusmn" | b"pm" | b"PlusMinus" => "\u{B1}",
285 b"sup2" => "\u{B2}",
286 b"sup3" => "\u{B3}",
287 b"acute" | b"DiacriticalAcute" => "\u{B4}",
288 b"micro" => "\u{B5}",
289 b"para" => "\u{B6}",
290 b"middot" | b"centerdot" | b"CenterDot" => "\u{B7}",
291 b"cedil" | b"Cedilla" => "\u{B8}",
292 b"sup1" => "\u{B9}",
293 b"ordm" => "\u{BA}",
294 b"raquo" => "\u{BB}",
295 b"frac14" => "\u{BC}",
296 b"frac12" | b"half" => "\u{BD}",
297 b"frac34" => "\u{BE}",
298 b"iquest" => "\u{BF}",
299 b"Agrave" => "\u{C0}",
300 b"Aacute" => "\u{C1}",
301 b"Acirc" => "\u{C2}",
302 b"Atilde" => "\u{C3}",
303 b"Auml" => "\u{C4}",
304 b"Aring" => "\u{C5}",
305 b"AElig" => "\u{C6}",
306 b"Ccedil" => "\u{C7}",
307 b"Egrave" => "\u{C8}",
308 b"Eacute" => "\u{C9}",
309 b"Ecirc" => "\u{CA}",
310 b"Euml" => "\u{CB}",
311 b"Igrave" => "\u{CC}",
312 b"Iacute" => "\u{CD}",
313 b"Icirc" => "\u{CE}",
314 b"Iuml" => "\u{CF}",
315 b"ETH" => "\u{D0}",
316 b"Ntilde" => "\u{D1}",
317 b"Ograve" => "\u{D2}",
318 b"Oacute" => "\u{D3}",
319 b"Ocirc" => "\u{D4}",
320 b"Otilde" => "\u{D5}",
321 b"Ouml" => "\u{D6}",
322 b"times" => "\u{D7}",
323 b"Oslash" => "\u{D8}",
324 b"Ugrave" => "\u{D9}",
325 b"Uacute" => "\u{DA}",
326 b"Ucirc" => "\u{DB}",
327 b"Uuml" => "\u{DC}",
328 b"Yacute" => "\u{DD}",
329 b"THORN" => "\u{DE}",
330 b"szlig" => "\u{DF}",
331 b"agrave" => "\u{E0}",
332 b"aacute" => "\u{E1}",
333 b"acirc" => "\u{E2}",
334 b"atilde" => "\u{E3}",
335 b"auml" => "\u{E4}",
336 b"aring" => "\u{E5}",
337 b"aelig" => "\u{E6}",
338 b"ccedil" => "\u{E7}",
339 b"egrave" => "\u{E8}",
340 b"eacute" => "\u{E9}",
341 b"ecirc" => "\u{EA}",
342 b"euml" => "\u{EB}",
343 b"igrave" => "\u{EC}",
344 b"iacute" => "\u{ED}",
345 b"icirc" => "\u{EE}",
346 b"iuml" => "\u{EF}",
347 b"eth" => "\u{F0}",
348 b"ntilde" => "\u{F1}",
349 b"ograve" => "\u{F2}",
350 b"oacute" => "\u{F3}",
351 b"ocirc" => "\u{F4}",
352 b"otilde" => "\u{F5}",
353 b"ouml" => "\u{F6}",
354 b"divide" | b"div" => "\u{F7}",
355 b"oslash" => "\u{F8}",
356 b"ugrave" => "\u{F9}",
357 b"uacute" => "\u{FA}",
358 b"ucirc" => "\u{FB}",
359 b"uuml" => "\u{FC}",
360 b"yacute" => "\u{FD}",
361 b"thorn" => "\u{FE}",
362 b"yuml" => "\u{FF}",
363 b"Amacr" => "\u{10}",
364 b"amacr" => "\u{10}",
365 b"Abreve" => "\u{10}",
366 b"abreve" => "\u{10}",
367 b"Aogon" => "\u{10}",
368 b"aogon" => "\u{10}",
369 b"Cacute" => "\u{10}",
370 b"cacute" => "\u{10}",
371 b"Ccirc" => "\u{10}",
372 b"ccirc" => "\u{10}",
373 b"Cdot" => "\u{10}",
374 b"cdot" => "\u{10}",
375 b"Ccaron" => "\u{10}",
376 b"ccaron" => "\u{10}",
377 b"Dcaron" => "\u{10}",
378 b"dcaron" => "\u{10}",
379 b"Dstrok" => "\u{11}",
380 b"dstrok" => "\u{11}",
381 b"Emacr" => "\u{11}",
382 b"emacr" => "\u{11}",
383 b"Edot" => "\u{11}",
384 b"edot" => "\u{11}",
385 b"Eogon" => "\u{11}",
386 b"eogon" => "\u{11}",
387 b"Ecaron" => "\u{11}",
388 b"ecaron" => "\u{11}",
389 b"Gcirc" => "\u{11}",
390 b"gcirc" => "\u{11}",
391 b"Gbreve" => "\u{11}",
392 b"gbreve" => "\u{11}",
393 b"Gdot" => "\u{12}",
394 b"gdot" => "\u{12}",
395 b"Gcedil" => "\u{12}",
396 b"Hcirc" => "\u{12}",
397 b"hcirc" => "\u{12}",
398 b"Hstrok" => "\u{12}",
399 b"hstrok" => "\u{12}",
400 b"Itilde" => "\u{12}",
401 b"itilde" => "\u{12}",
402 b"Imacr" => "\u{12}",
403 b"imacr" => "\u{12}",
404 b"Iogon" => "\u{12}",
405 b"iogon" => "\u{12}",
406 b"Idot" => "\u{13}",
407 b"imath" | b"inodot" => "\u{13}",
408 b"IJlig" => "\u{13}",
409 b"ijlig" => "\u{13}",
410 b"Jcirc" => "\u{13}",
411 b"jcirc" => "\u{13}",
412 b"Kcedil" => "\u{13}",
413 b"kcedil" => "\u{13}",
414 b"kgreen" => "\u{13}",
415 b"Lacute" => "\u{13}",
416 b"lacute" => "\u{13}",
417 b"Lcedil" => "\u{13}",
418 b"lcedil" => "\u{13}",
419 b"Lcaron" => "\u{13}",
420 b"lcaron" => "\u{13}",
421 b"Lmidot" => "\u{13}",
422 b"lmidot" => "\u{14}",
423 b"Lstrok" => "\u{14}",
424 b"lstrok" => "\u{14}",
425 b"Nacute" => "\u{14}",
426 b"nacute" => "\u{14}",
427 b"Ncedil" => "\u{14}",
428 b"ncedil" => "\u{14}",
429 b"Ncaron" => "\u{14}",
430 b"ncaron" => "\u{14}",
431 b"napos" => "\u{14}",
432 b"ENG" => "\u{14}",
433 b"eng" => "\u{14}",
434 b"Omacr" => "\u{14}",
435 b"omacr" => "\u{14}",
436 b"Odblac" => "\u{15}",
437 b"odblac" => "\u{15}",
438 b"OElig" => "\u{15}",
439 b"oelig" => "\u{15}",
440 b"Racute" => "\u{15}",
441 b"racute" => "\u{15}",
442 b"Rcedil" => "\u{15}",
443 b"rcedil" => "\u{15}",
444 b"Rcaron" => "\u{15}",
445 b"rcaron" => "\u{15}",
446 b"Sacute" => "\u{15}",
447 b"sacute" => "\u{15}",
448 b"Scirc" => "\u{15}",
449 b"scirc" => "\u{15}",
450 b"Scedil" => "\u{15}",
451 b"scedil" => "\u{15}",
452 b"Scaron" => "\u{16}",
453 b"scaron" => "\u{16}",
454 b"Tcedil" => "\u{16}",
455 b"tcedil" => "\u{16}",
456 b"Tcaron" => "\u{16}",
457 b"tcaron" => "\u{16}",
458 b"Tstrok" => "\u{16}",
459 b"tstrok" => "\u{16}",
460 b"Utilde" => "\u{16}",
461 b"utilde" => "\u{16}",
462 b"Umacr" => "\u{16}",
463 b"umacr" => "\u{16}",
464 b"Ubreve" => "\u{16}",
465 b"ubreve" => "\u{16}",
466 b"Uring" => "\u{16}",
467 b"uring" => "\u{16}",
468 b"Udblac" => "\u{17}",
469 b"udblac" => "\u{17}",
470 b"Uogon" => "\u{17}",
471 b"uogon" => "\u{17}",
472 b"Wcirc" => "\u{17}",
473 b"wcirc" => "\u{17}",
474 b"Ycirc" => "\u{17}",
475 b"ycirc" => "\u{17}",
476 b"Yuml" => "\u{17}",
477 b"Zacute" => "\u{17}",
478 b"zacute" => "\u{17}",
479 b"Zdot" => "\u{17}",
480 b"zdot" => "\u{17}",
481 b"Zcaron" => "\u{17}",
482 b"zcaron" => "\u{17}",
483 b"fnof" => "\u{19}",
484 b"imped" => "\u{1B}",
485 b"gacute" => "\u{1F}",
486 b"jmath" => "\u{23}",
487 b"circ" => "\u{2C}",
488 b"caron" | b"Hacek" => "\u{2C}",
489 b"breve" | b"Breve" => "\u{2D}",
490 b"dot" | b"DiacriticalDot" => "\u{2D}",
491 b"ring" => "\u{2D}",
492 b"ogon" => "\u{2D}",
493 b"tilde" | b"DiacriticalTilde" => "\u{2D}",
494 b"dblac" | b"DiacriticalDoubleAcute" => "\u{2D}",
495 b"DownBreve" => "\u{31}",
496 b"UnderBar" => "\u{33}",
497 b"Alpha" => "\u{39}",
498 b"Beta" => "\u{39}",
499 b"Gamma" => "\u{39}",
500 b"Delta" => "\u{39}",
501 b"Epsilon" => "\u{39}",
502 b"Zeta" => "\u{39}",
503 b"Eta" => "\u{39}",
504 b"Theta" => "\u{39}",
505 b"Iota" => "\u{39}",
506 b"Kappa" => "\u{39}",
507 b"Lambda" => "\u{39}",
508 b"Mu" => "\u{39}",
509 b"Nu" => "\u{39}",
510 b"Xi" => "\u{39}",
511 b"Omicron" => "\u{39}",
512 b"Pi" => "\u{3A}",
513 b"Rho" => "\u{3A}",
514 b"Sigma" => "\u{3A}",
515 b"Tau" => "\u{3A}",
516 b"Upsilon" => "\u{3A}",
517 b"Phi" => "\u{3A}",
518 b"Chi" => "\u{3A}",
519 b"Psi" => "\u{3A}",
520 b"Omega" => "\u{3A}",
521 b"alpha" => "\u{3B}",
522 b"beta" => "\u{3B}",
523 b"gamma" => "\u{3B}",
524 b"delta" => "\u{3B}",
525 b"epsiv" | b"varepsilon" | b"epsilon" => "\u{3B}",
526 b"zeta" => "\u{3B}",
527 b"eta" => "\u{3B}",
528 b"theta" => "\u{3B}",
529 b"iota" => "\u{3B}",
530 b"kappa" => "\u{3B}",
531 b"lambda" => "\u{3B}",
532 b"mu" => "\u{3B}",
533 b"nu" => "\u{3B}",
534 b"xi" => "\u{3B}",
535 b"omicron" => "\u{3B}",
536 b"pi" => "\u{3C}",
537 b"rho" => "\u{3C}",
538 b"sigmav" | b"varsigma" | b"sigmaf" => "\u{3C}",
539 b"sigma" => "\u{3C}",
540 b"tau" => "\u{3C}",
541 b"upsi" | b"upsilon" => "\u{3C}",
542 b"phi" | b"phiv" | b"varphi" => "\u{3C}",
543 b"chi" => "\u{3C}",
544 b"psi" => "\u{3C}",
545 b"omega" => "\u{3C}",
546 b"thetav" | b"vartheta" | b"thetasym" => "\u{3D}",
547 b"Upsi" | b"upsih" => "\u{3D}",
548 b"straightphi" => "\u{3D}",
549 b"piv" | b"varpi" => "\u{3D}",
550 b"Gammad" => "\u{3D}",
551 b"gammad" | b"digamma" => "\u{3D}",
552 b"kappav" | b"varkappa" => "\u{3F}",
553 b"rhov" | b"varrho" => "\u{3F}",
554 b"epsi" | b"straightepsilon" => "\u{3F}",
555 b"bepsi" | b"backepsilon" => "\u{3F}",
556 b"IOcy" => "\u{40}",
557 b"DJcy" => "\u{40}",
558 b"GJcy" => "\u{40}",
559 b"Jukcy" => "\u{40}",
560 b"DScy" => "\u{40}",
561 b"Iukcy" => "\u{40}",
562 b"YIcy" => "\u{40}",
563 b"Jsercy" => "\u{40}",
564 b"LJcy" => "\u{40}",
565 b"NJcy" => "\u{40}",
566 b"TSHcy" => "\u{40}",
567 b"KJcy" => "\u{40}",
568 b"Ubrcy" => "\u{40}",
569 b"DZcy" => "\u{40}",
570 b"Acy" => "\u{41}",
571 b"Bcy" => "\u{41}",
572 b"Vcy" => "\u{41}",
573 b"Gcy" => "\u{41}",
574 b"Dcy" => "\u{41}",
575 b"IEcy" => "\u{41}",
576 b"ZHcy" => "\u{41}",
577 b"Zcy" => "\u{41}",
578 b"Icy" => "\u{41}",
579 b"Jcy" => "\u{41}",
580 b"Kcy" => "\u{41}",
581 b"Lcy" => "\u{41}",
582 b"Mcy" => "\u{41}",
583 b"Ncy" => "\u{41}",
584 b"Ocy" => "\u{41}",
585 b"Pcy" => "\u{41}",
586 b"Rcy" => "\u{42}",
587 b"Scy" => "\u{42}",
588 b"Tcy" => "\u{42}",
589 b"Ucy" => "\u{42}",
590 b"Fcy" => "\u{42}",
591 b"KHcy" => "\u{42}",
592 b"TScy" => "\u{42}",
593 b"CHcy" => "\u{42}",
594 b"SHcy" => "\u{42}",
595 b"SHCHcy" => "\u{42}",
596 b"HARDcy" => "\u{42}",
597 b"Ycy" => "\u{42}",
598 b"SOFTcy" => "\u{42}",
599 b"Ecy" => "\u{42}",
600 b"YUcy" => "\u{42}",
601 b"YAcy" => "\u{42}",
602 b"acy" => "\u{43}",
603 b"bcy" => "\u{43}",
604 b"vcy" => "\u{43}",
605 b"gcy" => "\u{43}",
606 b"dcy" => "\u{43}",
607 b"iecy" => "\u{43}",
608 b"zhcy" => "\u{43}",
609 b"zcy" => "\u{43}",
610 b"icy" => "\u{43}",
611 b"jcy" => "\u{43}",
612 b"kcy" => "\u{43}",
613 b"lcy" => "\u{43}",
614 b"mcy" => "\u{43}",
615 b"ncy" => "\u{43}",
616 b"ocy" => "\u{43}",
617 b"pcy" => "\u{43}",
618 b"rcy" => "\u{44}",
619 b"scy" => "\u{44}",
620 b"tcy" => "\u{44}",
621 b"ucy" => "\u{44}",
622 b"fcy" => "\u{44}",
623 b"khcy" => "\u{44}",
624 b"tscy" => "\u{44}",
625 b"chcy" => "\u{44}",
626 b"shcy" => "\u{44}",
627 b"shchcy" => "\u{44}",
628 b"hardcy" => "\u{44}",
629 b"ycy" => "\u{44}",
630 b"softcy" => "\u{44}",
631 b"ecy" => "\u{44}",
632 b"yucy" => "\u{44}",
633 b"yacy" => "\u{44}",
634 b"iocy" => "\u{45}",
635 b"djcy" => "\u{45}",
636 b"gjcy" => "\u{45}",
637 b"jukcy" => "\u{45}",
638 b"dscy" => "\u{45}",
639 b"iukcy" => "\u{45}",
640 b"yicy" => "\u{45}",
641 b"jsercy" => "\u{45}",
642 b"ljcy" => "\u{45}",
643 b"njcy" => "\u{45}",
644 b"tshcy" => "\u{45}",
645 b"kjcy" => "\u{45}",
646 b"ubrcy" => "\u{45}",
647 b"dzcy" => "\u{45}",
648 b"ensp" => "\u{2002}",
649 b"emsp" => "\u{2003}",
650 b"emsp13" => "\u{2004}",
651 b"emsp14" => "\u{2005}",
652 b"numsp" => "\u{2007}",
653 b"puncsp" => "\u{2008}",
654 b"thinsp" | b"ThinSpace" => "\u{2009}",
655 b"hairsp" | b"VeryThinSpace" => "\u{200A}",
656 b"ZeroWidthSpace"
657 | b"NegativeVeryThinSpace"
658 | b"NegativeThinSpace"
659 | b"NegativeMediumSpace"
660 | b"NegativeThickSpace" => "\u{200B}",
661 b"zwnj" => "\u{200C}",
662 b"zwj" => "\u{200D}",
663 b"lrm" => "\u{200E}",
664 b"rlm" => "\u{200F}",
665 b"hyphen" | b"dash" => "\u{2010}",
666 b"ndash" => "\u{2013}",
667 b"mdash" => "\u{2014}",
668 b"horbar" => "\u{2015}",
669 b"Verbar" | b"Vert" => "\u{2016}",
670 b"lsquo" | b"OpenCurlyQuote" => "\u{2018}",
671 b"rsquo" | b"rsquor" | b"CloseCurlyQuote" => "\u{2019}",
672 b"lsquor" | b"sbquo" => "\u{201A}",
673 b"ldquo" | b"OpenCurlyDoubleQuote" => "\u{201C}",
674 b"rdquo" | b"rdquor" | b"CloseCurlyDoubleQuote" => "\u{201D}",
675 b"ldquor" | b"bdquo" => "\u{201E}",
676 b"dagger" => "\u{2020}",
677 b"Dagger" | b"ddagger" => "\u{2021}",
678 b"bull" | b"bullet" => "\u{2022}",
679 b"nldr" => "\u{2025}",
680 b"hellip" | b"mldr" => "\u{2026}",
681 b"permil" => "\u{2030}",
682 b"pertenk" => "\u{2031}",
683 b"prime" => "\u{2032}",
684 b"Prime" => "\u{2033}",
685 b"tprime" => "\u{2034}",
686 b"bprime" | b"backprime" => "\u{2035}",
687 b"lsaquo" => "\u{2039}",
688 b"rsaquo" => "\u{203A}",
689 b"oline" => "\u{203E}",
690 b"caret" => "\u{2041}",
691 b"hybull" => "\u{2043}",
692 b"frasl" => "\u{2044}",
693 b"bsemi" => "\u{204F}",
694 b"qprime" => "\u{2057}",
695 b"MediumSpace" => "\u{205F}",
696 b"NoBreak" => "\u{2060}",
697 b"ApplyFunction" | b"af" => "\u{2061}",
698 b"InvisibleTimes" | b"it" => "\u{2062}",
699 b"InvisibleComma" | b"ic" => "\u{2063}",
700 b"euro" => "\u{20AC}",
701 b"tdot" | b"TripleDot" => "\u{20DB}",
702 b"DotDot" => "\u{20DC}",
703 b"Copf" | b"complexes" => "\u{2102}",
704 b"incare" => "\u{2105}",
705 b"gscr" => "\u{210A}",
706 b"hamilt" | b"HilbertSpace" | b"Hscr" => "\u{210B}",
707 b"Hfr" | b"Poincareplane" => "\u{210C}",
708 b"quaternions" | b"Hopf" => "\u{210D}",
709 b"planckh" => "\u{210E}",
710 b"planck" | b"hbar" | b"plankv" | b"hslash" => "\u{210F}",
711 b"Iscr" | b"imagline" => "\u{2110}",
712 b"image" | b"Im" | b"imagpart" | b"Ifr" => "\u{2111}",
713 b"Lscr" | b"lagran" | b"Laplacetrf" => "\u{2112}",
714 b"ell" => "\u{2113}",
715 b"Nopf" | b"naturals" => "\u{2115}",
716 b"numero" => "\u{2116}",
717 b"copysr" => "\u{2117}",
718 b"weierp" | b"wp" => "\u{2118}",
719 b"Popf" | b"primes" => "\u{2119}",
720 b"rationals" | b"Qopf" => "\u{211A}",
721 b"Rscr" | b"realine" => "\u{211B}",
722 b"real" | b"Re" | b"realpart" | b"Rfr" => "\u{211C}",
723 b"reals" | b"Ropf" => "\u{211D}",
724 b"rx" => "\u{211E}",
725 b"trade" | b"TRADE" => "\u{2122}",
726 b"integers" | b"Zopf" => "\u{2124}",
727 b"ohm" => "\u{2126}",
728 b"mho" => "\u{2127}",
729 b"Zfr" | b"zeetrf" => "\u{2128}",
730 b"iiota" => "\u{2129}",
731 b"angst" => "\u{212B}",
732 b"bernou" | b"Bernoullis" | b"Bscr" => "\u{212C}",
733 b"Cfr" | b"Cayleys" => "\u{212D}",
734 b"escr" => "\u{212F}",
735 b"Escr" | b"expectation" => "\u{2130}",
736 b"Fscr" | b"Fouriertrf" => "\u{2131}",
737 b"phmmat" | b"Mellintrf" | b"Mscr" => "\u{2133}",
738 b"order" | b"orderof" | b"oscr" => "\u{2134}",
739 b"alefsym" | b"aleph" => "\u{2135}",
740 b"beth" => "\u{2136}",
741 b"gimel" => "\u{2137}",
742 b"daleth" => "\u{2138}",
743 b"CapitalDifferentialD" | b"DD" => "\u{2145}",
744 b"DifferentialD" | b"dd" => "\u{2146}",
745 b"ExponentialE" | b"exponentiale" | b"ee" => "\u{2147}",
746 b"ImaginaryI" | b"ii" => "\u{2148}",
747 b"frac13" => "\u{2153}",
748 b"frac23" => "\u{2154}",
749 b"frac15" => "\u{2155}",
750 b"frac25" => "\u{2156}",
751 b"frac35" => "\u{2157}",
752 b"frac45" => "\u{2158}",
753 b"frac16" => "\u{2159}",
754 b"frac56" => "\u{215A}",
755 b"frac18" => "\u{215B}",
756 b"frac38" => "\u{215C}",
757 b"frac58" => "\u{215D}",
758 b"frac78" => "\u{215E}",
759 b"larr" | b"leftarrow" | b"LeftArrow" | b"slarr" | b"ShortLeftArrow" => "\u{2190}",
760 b"uarr" | b"uparrow" | b"UpArrow" | b"ShortUpArrow" => "\u{2191}",
761 b"rarr" | b"rightarrow" | b"RightArrow" | b"srarr" | b"ShortRightArrow" => "\u{2192}",
762 b"darr" | b"downarrow" | b"DownArrow" | b"ShortDownArrow" => "\u{2193}",
763 b"harr" | b"leftrightarrow" | b"LeftRightArrow" => "\u{2194}",
764 b"varr" | b"updownarrow" | b"UpDownArrow" => "\u{2195}",
765 b"nwarr" | b"UpperLeftArrow" | b"nwarrow" => "\u{2196}",
766 b"nearr" | b"UpperRightArrow" | b"nearrow" => "\u{2197}",
767 b"searr" | b"searrow" | b"LowerRightArrow" => "\u{2198}",
768 b"swarr" | b"swarrow" | b"LowerLeftArrow" => "\u{2199}",
769 b"nlarr" | b"nleftarrow" => "\u{219A}",
770 b"nrarr" | b"nrightarrow" => "\u{219B}",
771 b"rarrw" | b"rightsquigarrow" => "\u{219D}",
772 b"Larr" | b"twoheadleftarrow" => "\u{219E}",
773 b"Uarr" => "\u{219F}",
774 b"Rarr" | b"twoheadrightarrow" => "\u{21A0}",
775 b"Darr" => "\u{21A1}",
776 b"larrtl" | b"leftarrowtail" => "\u{21A2}",
777 b"rarrtl" | b"rightarrowtail" => "\u{21A3}",
778 b"LeftTeeArrow" | b"mapstoleft" => "\u{21A4}",
779 b"UpTeeArrow" | b"mapstoup" => "\u{21A5}",
780 b"map" | b"RightTeeArrow" | b"mapsto" => "\u{21A6}",
781 b"DownTeeArrow" | b"mapstodown" => "\u{21A7}",
782 b"larrhk" | b"hookleftarrow" => "\u{21A9}",
783 b"rarrhk" | b"hookrightarrow" => "\u{21AA}",
784 b"larrlp" | b"looparrowleft" => "\u{21AB}",
785 b"rarrlp" | b"looparrowright" => "\u{21AC}",
786 b"harrw" | b"leftrightsquigarrow" => "\u{21AD}",
787 b"nharr" | b"nleftrightarrow" => "\u{21AE}",
788 b"lsh" | b"Lsh" => "\u{21B0}",
789 b"rsh" | b"Rsh" => "\u{21B1}",
790 b"ldsh" => "\u{21B2}",
791 b"rdsh" => "\u{21B3}",
792 b"crarr" => "\u{21B5}",
793 b"cularr" | b"curvearrowleft" => "\u{21B6}",
794 b"curarr" | b"curvearrowright" => "\u{21B7}",
795 b"olarr" | b"circlearrowleft" => "\u{21BA}",
796 b"orarr" | b"circlearrowright" => "\u{21BB}",
797 b"lharu" | b"LeftVector" | b"leftharpoonup" => "\u{21BC}",
798 b"lhard" | b"leftharpoondown" | b"DownLeftVector" => "\u{21BD}",
799 b"uharr" | b"upharpoonright" | b"RightUpVector" => "\u{21BE}",
800 b"uharl" | b"upharpoonleft" | b"LeftUpVector" => "\u{21BF}",
801 b"rharu" | b"RightVector" | b"rightharpoonup" => "\u{21C0}",
802 b"rhard" | b"rightharpoondown" | b"DownRightVector" => "\u{21C1}",
803 b"dharr" | b"RightDownVector" | b"downharpoonright" => "\u{21C2}",
804 b"dharl" | b"LeftDownVector" | b"downharpoonleft" => "\u{21C3}",
805 b"rlarr" | b"rightleftarrows" | b"RightArrowLeftArrow" => "\u{21C4}",
806 b"udarr" | b"UpArrowDownArrow" => "\u{21C5}",
807 b"lrarr" | b"leftrightarrows" | b"LeftArrowRightArrow" => "\u{21C6}",
808 b"llarr" | b"leftleftarrows" => "\u{21C7}",
809 b"uuarr" | b"upuparrows" => "\u{21C8}",
810 b"rrarr" | b"rightrightarrows" => "\u{21C9}",
811 b"ddarr" | b"downdownarrows" => "\u{21CA}",
812 b"lrhar" | b"ReverseEquilibrium" | b"leftrightharpoons" => "\u{21CB}",
813 b"rlhar" | b"rightleftharpoons" | b"Equilibrium" => "\u{21CC}",
814 b"nlArr" | b"nLeftarrow" => "\u{21CD}",
815 b"nhArr" | b"nLeftrightarrow" => "\u{21CE}",
816 b"nrArr" | b"nRightarrow" => "\u{21CF}",
817 b"lArr" | b"Leftarrow" | b"DoubleLeftArrow" => "\u{21D0}",
818 b"uArr" | b"Uparrow" | b"DoubleUpArrow" => "\u{21D1}",
819 b"rArr" | b"Rightarrow" | b"Implies" | b"DoubleRightArrow" => "\u{21D2}",
820 b"dArr" | b"Downarrow" | b"DoubleDownArrow" => "\u{21D3}",
821 b"hArr" | b"Leftrightarrow" | b"DoubleLeftRightArrow" | b"iff" => "\u{21D4}",
822 b"vArr" | b"Updownarrow" | b"DoubleUpDownArrow" => "\u{21D5}",
823 b"nwArr" => "\u{21D6}",
824 b"neArr" => "\u{21D7}",
825 b"seArr" => "\u{21D8}",
826 b"swArr" => "\u{21D9}",
827 b"lAarr" | b"Lleftarrow" => "\u{21DA}",
828 b"rAarr" | b"Rrightarrow" => "\u{21DB}",
829 b"zigrarr" => "\u{21DD}",
830 b"larrb" | b"LeftArrowBar" => "\u{21E4}",
831 b"rarrb" | b"RightArrowBar" => "\u{21E5}",
832 b"duarr" | b"DownArrowUpArrow" => "\u{21F5}",
833 b"loarr" => "\u{21FD}",
834 b"roarr" => "\u{21FE}",
835 b"hoarr" => "\u{21FF}",
836 b"forall" | b"ForAll" => "\u{2200}",
837 b"comp" | b"complement" => "\u{2201}",
838 b"part" | b"PartialD" => "\u{2202}",
839 b"exist" | b"Exists" => "\u{2203}",
840 b"nexist" | b"NotExists" | b"nexists" => "\u{2204}",
841 b"empty" | b"emptyset" | b"emptyv" | b"varnothing" => "\u{2205}",
842 b"nabla" | b"Del" => "\u{2207}",
843 b"isin" | b"isinv" | b"Element" | b"in" => "\u{2208}",
844 b"notin" | b"NotElement" | b"notinva" => "\u{2209}",
845 b"niv" | b"ReverseElement" | b"ni" | b"SuchThat" => "\u{220B}",
846 b"notni" | b"notniva" | b"NotReverseElement" => "\u{220C}",
847 b"prod" | b"Product" => "\u{220F}",
848 b"coprod" | b"Coproduct" => "\u{2210}",
849 b"sum" | b"Sum" => "\u{2211}",
850 b"minus" => "\u{2212}",
851 b"mnplus" | b"mp" | b"MinusPlus" => "\u{2213}",
852 b"plusdo" | b"dotplus" => "\u{2214}",
853 b"setmn" | b"setminus" | b"Backslash" | b"ssetmn" | b"smallsetminus" => "\u{2216}",
854 b"lowast" => "\u{2217}",
855 b"compfn" | b"SmallCircle" => "\u{2218}",
856 b"radic" | b"Sqrt" => "\u{221A}",
857 b"prop" | b"propto" | b"Proportional" | b"vprop" | b"varpropto" => "\u{221D}",
858 b"infin" => "\u{221E}",
859 b"angrt" => "\u{221F}",
860 b"ang" | b"angle" => "\u{2220}",
861 b"angmsd" | b"measuredangle" => "\u{2221}",
862 b"angsph" => "\u{2222}",
863 b"mid" | b"VerticalBar" | b"smid" | b"shortmid" => "\u{2223}",
864 b"nmid" | b"NotVerticalBar" | b"nsmid" | b"nshortmid" => "\u{2224}",
865 b"par" | b"parallel" | b"DoubleVerticalBar" | b"spar" | b"shortparallel" => "\u{2225}",
866 b"npar" | b"nparallel" | b"NotDoubleVerticalBar" | b"nspar" | b"nshortparallel" => {
867 "\u{2226}"
868 }
869 b"and" | b"wedge" => "\u{2227}",
870 b"or" | b"vee" => "\u{2228}",
871 b"cap" => "\u{2229}",
872 b"cup" => "\u{222A}",
873 b"int" | b"Integral" => "\u{222B}",
874 b"Int" => "\u{222C}",
875 b"tint" | b"iiint" => "\u{222D}",
876 b"conint" | b"oint" | b"ContourIntegral" => "\u{222E}",
877 b"Conint" | b"DoubleContourIntegral" => "\u{222F}",
878 b"Cconint" => "\u{2230}",
879 b"cwint" => "\u{2231}",
880 b"cwconint" | b"ClockwiseContourIntegral" => "\u{2232}",
881 b"awconint" | b"CounterClockwiseContourIntegral" => "\u{2233}",
882 b"there4" | b"therefore" | b"Therefore" => "\u{2234}",
883 b"becaus" | b"because" | b"Because" => "\u{2235}",
884 b"ratio" => "\u{2236}",
885 b"Colon" | b"Proportion" => "\u{2237}",
886 b"minusd" | b"dotminus" => "\u{2238}",
887 b"mDDot" => "\u{223A}",
888 b"homtht" => "\u{223B}",
889 b"sim" | b"Tilde" | b"thksim" | b"thicksim" => "\u{223C}",
890 b"bsim" | b"backsim" => "\u{223D}",
891 b"ac" | b"mstpos" => "\u{223E}",
892 b"acd" => "\u{223F}",
893 b"wreath" | b"VerticalTilde" | b"wr" => "\u{2240}",
894 b"nsim" | b"NotTilde" => "\u{2241}",
895 b"esim" | b"EqualTilde" | b"eqsim" => "\u{2242}",
896 b"sime" | b"TildeEqual" | b"simeq" => "\u{2243}",
897 b"nsime" | b"nsimeq" | b"NotTildeEqual" => "\u{2244}",
898 b"cong" | b"TildeFullEqual" => "\u{2245}",
899 b"simne" => "\u{2246}",
900 b"ncong" | b"NotTildeFullEqual" => "\u{2247}",
901 b"asymp" | b"ap" | b"TildeTilde" | b"approx" | b"thkap" | b"thickapprox" => "\u{2248}",
902 b"nap" | b"NotTildeTilde" | b"napprox" => "\u{2249}",
903 b"ape" | b"approxeq" => "\u{224A}",
904 b"apid" => "\u{224B}",
905 b"bcong" | b"backcong" => "\u{224C}",
906 b"asympeq" | b"CupCap" => "\u{224D}",
907 b"bump" | b"HumpDownHump" | b"Bumpeq" => "\u{224E}",
908 b"bumpe" | b"HumpEqual" | b"bumpeq" => "\u{224F}",
909 b"esdot" | b"DotEqual" | b"doteq" => "\u{2250}",
910 b"eDot" | b"doteqdot" => "\u{2251}",
911 b"efDot" | b"fallingdotseq" => "\u{2252}",
912 b"erDot" | b"risingdotseq" => "\u{2253}",
913 b"colone" | b"coloneq" | b"Assign" => "\u{2254}",
914 b"ecolon" | b"eqcolon" => "\u{2255}",
915 b"ecir" | b"eqcirc" => "\u{2256}",
916 b"cire" | b"circeq" => "\u{2257}",
917 b"wedgeq" => "\u{2259}",
918 b"veeeq" => "\u{225A}",
919 b"trie" | b"triangleq" => "\u{225C}",
920 b"equest" | b"questeq" => "\u{225F}",
921 b"ne" | b"NotEqual" => "\u{2260}",
922 b"equiv" | b"Congruent" => "\u{2261}",
923 b"nequiv" | b"NotCongruent" => "\u{2262}",
924 b"le" | b"leq" => "\u{2264}",
925 b"ge" | b"GreaterEqual" | b"geq" => "\u{2265}",
926 b"lE" | b"LessFullEqual" | b"leqq" => "\u{2266}",
927 b"gE" | b"GreaterFullEqual" | b"geqq" => "\u{2267}",
928 b"lnE" | b"lneqq" => "\u{2268}",
929 b"gnE" | b"gneqq" => "\u{2269}",
930 b"Lt" | b"NestedLessLess" | b"ll" => "\u{226A}",
931 b"Gt" | b"NestedGreaterGreater" | b"gg" => "\u{226B}",
932 b"twixt" | b"between" => "\u{226C}",
933 b"NotCupCap" => "\u{226D}",
934 b"nlt" | b"NotLess" | b"nless" => "\u{226E}",
935 b"ngt" | b"NotGreater" | b"ngtr" => "\u{226F}",
936 b"nle" | b"NotLessEqual" | b"nleq" => "\u{2270}",
937 b"nge" | b"NotGreaterEqual" | b"ngeq" => "\u{2271}",
938 b"lsim" | b"LessTilde" | b"lesssim" => "\u{2272}",
939 b"gsim" | b"gtrsim" | b"GreaterTilde" => "\u{2273}",
940 b"nlsim" | b"NotLessTilde" => "\u{2274}",
941 b"ngsim" | b"NotGreaterTilde" => "\u{2275}",
942 b"lg" | b"lessgtr" | b"LessGreater" => "\u{2276}",
943 b"gl" | b"gtrless" | b"GreaterLess" => "\u{2277}",
944 b"ntlg" | b"NotLessGreater" => "\u{2278}",
945 b"ntgl" | b"NotGreaterLess" => "\u{2279}",
946 b"pr" | b"Precedes" | b"prec" => "\u{227A}",
947 b"sc" | b"Succeeds" | b"succ" => "\u{227B}",
948 b"prcue" | b"PrecedesSlantEqual" | b"preccurlyeq" => "\u{227C}",
949 b"sccue" | b"SucceedsSlantEqual" | b"succcurlyeq" => "\u{227D}",
950 b"prsim" | b"precsim" | b"PrecedesTilde" => "\u{227E}",
951 b"scsim" | b"succsim" | b"SucceedsTilde" => "\u{227F}",
952 b"npr" | b"nprec" | b"NotPrecedes" => "\u{2280}",
953 b"nsc" | b"nsucc" | b"NotSucceeds" => "\u{2281}",
954 b"sub" | b"subset" => "\u{2282}",
955 b"sup" | b"supset" | b"Superset" => "\u{2283}",
956 b"nsub" => "\u{2284}",
957 b"nsup" => "\u{2285}",
958 b"sube" | b"SubsetEqual" | b"subseteq" => "\u{2286}",
959 b"supe" | b"supseteq" | b"SupersetEqual" => "\u{2287}",
960 b"nsube" | b"nsubseteq" | b"NotSubsetEqual" => "\u{2288}",
961 b"nsupe" | b"nsupseteq" | b"NotSupersetEqual" => "\u{2289}",
962 b"subne" | b"subsetneq" => "\u{228A}",
963 b"supne" | b"supsetneq" => "\u{228B}",
964 b"cupdot" => "\u{228D}",
965 b"uplus" | b"UnionPlus" => "\u{228E}",
966 b"sqsub" | b"SquareSubset" | b"sqsubset" => "\u{228F}",
967 b"sqsup" | b"SquareSuperset" | b"sqsupset" => "\u{2290}",
968 b"sqsube" | b"SquareSubsetEqual" | b"sqsubseteq" => "\u{2291}",
969 b"sqsupe" | b"SquareSupersetEqual" | b"sqsupseteq" => "\u{2292}",
970 b"sqcap" | b"SquareIntersection" => "\u{2293}",
971 b"sqcup" | b"SquareUnion" => "\u{2294}",
972 b"oplus" | b"CirclePlus" => "\u{2295}",
973 b"ominus" | b"CircleMinus" => "\u{2296}",
974 b"otimes" | b"CircleTimes" => "\u{2297}",
975 b"osol" => "\u{2298}",
976 b"odot" | b"CircleDot" => "\u{2299}",
977 b"ocir" | b"circledcirc" => "\u{229A}",
978 b"oast" | b"circledast" => "\u{229B}",
979 b"odash" | b"circleddash" => "\u{229D}",
980 b"plusb" | b"boxplus" => "\u{229E}",
981 b"minusb" | b"boxminus" => "\u{229F}",
982 b"timesb" | b"boxtimes" => "\u{22A0}",
983 b"sdotb" | b"dotsquare" => "\u{22A1}",
984 b"vdash" | b"RightTee" => "\u{22A2}",
985 b"dashv" | b"LeftTee" => "\u{22A3}",
986 b"top" | b"DownTee" => "\u{22A4}",
987 b"bottom" | b"bot" | b"perp" | b"UpTee" => "\u{22A5}",
988 b"models" => "\u{22A7}",
989 b"vDash" | b"DoubleRightTee" => "\u{22A8}",
990 b"Vdash" => "\u{22A9}",
991 b"Vvdash" => "\u{22AA}",
992 b"VDash" => "\u{22AB}",
993 b"nvdash" => "\u{22AC}",
994 b"nvDash" => "\u{22AD}",
995 b"nVdash" => "\u{22AE}",
996 b"nVDash" => "\u{22AF}",
997 b"prurel" => "\u{22B0}",
998 b"vltri" | b"vartriangleleft" | b"LeftTriangle" => "\u{22B2}",
999 b"vrtri" | b"vartriangleright" | b"RightTriangle" => "\u{22B3}",
1000 b"ltrie" | b"trianglelefteq" | b"LeftTriangleEqual" => "\u{22B4}",
1001 b"rtrie" | b"trianglerighteq" | b"RightTriangleEqual" => "\u{22B5}",
1002 b"origof" => "\u{22B6}",
1003 b"imof" => "\u{22B7}",
1004 b"mumap" | b"multimap" => "\u{22B8}",
1005 b"hercon" => "\u{22B9}",
1006 b"intcal" | b"intercal" => "\u{22BA}",
1007 b"veebar" => "\u{22BB}",
1008 b"barvee" => "\u{22BD}",
1009 b"angrtvb" => "\u{22BE}",
1010 b"lrtri" => "\u{22BF}",
1011 b"xwedge" | b"Wedge" | b"bigwedge" => "\u{22C0}",
1012 b"xvee" | b"Vee" | b"bigvee" => "\u{22C1}",
1013 b"xcap" | b"Intersection" | b"bigcap" => "\u{22C2}",
1014 b"xcup" | b"Union" | b"bigcup" => "\u{22C3}",
1015 b"diam" | b"diamond" | b"Diamond" => "\u{22C4}",
1016 b"sdot" => "\u{22C5}",
1017 b"sstarf" | b"Star" => "\u{22C6}",
1018 b"divonx" | b"divideontimes" => "\u{22C7}",
1019 b"bowtie" => "\u{22C8}",
1020 b"ltimes" => "\u{22C9}",
1021 b"rtimes" => "\u{22CA}",
1022 b"lthree" | b"leftthreetimes" => "\u{22CB}",
1023 b"rthree" | b"rightthreetimes" => "\u{22CC}",
1024 b"bsime" | b"backsimeq" => "\u{22CD}",
1025 b"cuvee" | b"curlyvee" => "\u{22CE}",
1026 b"cuwed" | b"curlywedge" => "\u{22CF}",
1027 b"Sub" | b"Subset" => "\u{22D0}",
1028 b"Sup" | b"Supset" => "\u{22D1}",
1029 b"Cap" => "\u{22D2}",
1030 b"Cup" => "\u{22D3}",
1031 b"fork" | b"pitchfork" => "\u{22D4}",
1032 b"epar" => "\u{22D5}",
1033 b"ltdot" | b"lessdot" => "\u{22D6}",
1034 b"gtdot" | b"gtrdot" => "\u{22D7}",
1035 b"Ll" => "\u{22D8}",
1036 b"Gg" | b"ggg" => "\u{22D9}",
1037 b"leg" | b"LessEqualGreater" | b"lesseqgtr" => "\u{22DA}",
1038 b"gel" | b"gtreqless" | b"GreaterEqualLess" => "\u{22DB}",
1039 b"cuepr" | b"curlyeqprec" => "\u{22DE}",
1040 b"cuesc" | b"curlyeqsucc" => "\u{22DF}",
1041 b"nprcue" | b"NotPrecedesSlantEqual" => "\u{22E0}",
1042 b"nsccue" | b"NotSucceedsSlantEqual" => "\u{22E1}",
1043 b"nsqsube" | b"NotSquareSubsetEqual" => "\u{22E2}",
1044 b"nsqsupe" | b"NotSquareSupersetEqual" => "\u{22E3}",
1045 b"lnsim" => "\u{22E6}",
1046 b"gnsim" => "\u{22E7}",
1047 b"prnsim" | b"precnsim" => "\u{22E8}",
1048 b"scnsim" | b"succnsim" => "\u{22E9}",
1049 b"nltri" | b"ntriangleleft" | b"NotLeftTriangle" => "\u{22EA}",
1050 b"nrtri" | b"ntriangleright" | b"NotRightTriangle" => "\u{22EB}",
1051 b"nltrie" | b"ntrianglelefteq" | b"NotLeftTriangleEqual" => "\u{22EC}",
1052 b"nrtrie" | b"ntrianglerighteq" | b"NotRightTriangleEqual" => "\u{22ED}",
1053 b"vellip" => "\u{22EE}",
1054 b"ctdot" => "\u{22EF}",
1055 b"utdot" => "\u{22F0}",
1056 b"dtdot" => "\u{22F1}",
1057 b"disin" => "\u{22F2}",
1058 b"isinsv" => "\u{22F3}",
1059 b"isins" => "\u{22F4}",
1060 b"isindot" => "\u{22F5}",
1061 b"notinvc" => "\u{22F6}",
1062 b"notinvb" => "\u{22F7}",
1063 b"isinE" => "\u{22F9}",
1064 b"nisd" => "\u{22FA}",
1065 b"xnis" => "\u{22FB}",
1066 b"nis" => "\u{22FC}",
1067 b"notnivc" => "\u{22FD}",
1068 b"notnivb" => "\u{22FE}",
1069 b"barwed" | b"barwedge" => "\u{2305}",
1070 b"Barwed" | b"doublebarwedge" => "\u{2306}",
1071 b"lceil" | b"LeftCeiling" => "\u{2308}",
1072 b"rceil" | b"RightCeiling" => "\u{2309}",
1073 b"lfloor" | b"LeftFloor" => "\u{230A}",
1074 b"rfloor" | b"RightFloor" => "\u{230B}",
1075 b"drcrop" => "\u{230C}",
1076 b"dlcrop" => "\u{230D}",
1077 b"urcrop" => "\u{230E}",
1078 b"ulcrop" => "\u{230F}",
1079 b"bnot" => "\u{2310}",
1080 b"profline" => "\u{2312}",
1081 b"profsurf" => "\u{2313}",
1082 b"telrec" => "\u{2315}",
1083 b"target" => "\u{2316}",
1084 b"ulcorn" | b"ulcorner" => "\u{231C}",
1085 b"urcorn" | b"urcorner" => "\u{231D}",
1086 b"dlcorn" | b"llcorner" => "\u{231E}",
1087 b"drcorn" | b"lrcorner" => "\u{231F}",
1088 b"frown" | b"sfrown" => "\u{2322}",
1089 b"smile" | b"ssmile" => "\u{2323}",
1090 b"cylcty" => "\u{232D}",
1091 b"profalar" => "\u{232E}",
1092 b"topbot" => "\u{2336}",
1093 b"ovbar" => "\u{233D}",
1094 b"solbar" => "\u{233F}",
1095 b"angzarr" => "\u{237C}",
1096 b"lmoust" | b"lmoustache" => "\u{23B0}",
1097 b"rmoust" | b"rmoustache" => "\u{23B1}",
1098 b"tbrk" | b"OverBracket" => "\u{23B4}",
1099 b"bbrk" | b"UnderBracket" => "\u{23B5}",
1100 b"bbrktbrk" => "\u{23B6}",
1101 b"OverParenthesis" => "\u{23DC}",
1102 b"UnderParenthesis" => "\u{23DD}",
1103 b"OverBrace" => "\u{23DE}",
1104 b"UnderBrace" => "\u{23DF}",
1105 b"trpezium" => "\u{23E2}",
1106 b"elinters" => "\u{23E7}",
1107 b"blank" => "\u{2423}",
1108 b"oS" | b"circledS" => "\u{24C8}",
1109 b"boxh" | b"HorizontalLine" => "\u{2500}",
1110 b"boxv" => "\u{2502}",
1111 b"boxdr" => "\u{250C}",
1112 b"boxdl" => "\u{2510}",
1113 b"boxur" => "\u{2514}",
1114 b"boxul" => "\u{2518}",
1115 b"boxvr" => "\u{251C}",
1116 b"boxvl" => "\u{2524}",
1117 b"boxhd" => "\u{252C}",
1118 b"boxhu" => "\u{2534}",
1119 b"boxvh" => "\u{253C}",
1120 b"boxH" => "\u{2550}",
1121 b"boxV" => "\u{2551}",
1122 b"boxdR" => "\u{2552}",
1123 b"boxDr" => "\u{2553}",
1124 b"boxDR" => "\u{2554}",
1125 b"boxdL" => "\u{2555}",
1126 b"boxDl" => "\u{2556}",
1127 b"boxDL" => "\u{2557}",
1128 b"boxuR" => "\u{2558}",
1129 b"boxUr" => "\u{2559}",
1130 b"boxUR" => "\u{255A}",
1131 b"boxuL" => "\u{255B}",
1132 b"boxUl" => "\u{255C}",
1133 b"boxUL" => "\u{255D}",
1134 b"boxvR" => "\u{255E}",
1135 b"boxVr" => "\u{255F}",
1136 b"boxVR" => "\u{2560}",
1137 b"boxvL" => "\u{2561}",
1138 b"boxVl" => "\u{2562}",
1139 b"boxVL" => "\u{2563}",
1140 b"boxHd" => "\u{2564}",
1141 b"boxhD" => "\u{2565}",
1142 b"boxHD" => "\u{2566}",
1143 b"boxHu" => "\u{2567}",
1144 b"boxhU" => "\u{2568}",
1145 b"boxHU" => "\u{2569}",
1146 b"boxvH" => "\u{256A}",
1147 b"boxVh" => "\u{256B}",
1148 b"boxVH" => "\u{256C}",
1149 b"uhblk" => "\u{2580}",
1150 b"lhblk" => "\u{2584}",
1151 b"block" => "\u{2588}",
1152 b"blk14" => "\u{2591}",
1153 b"blk12" => "\u{2592}",
1154 b"blk34" => "\u{2593}",
1155 b"squ" | b"square" | b"Square" => "\u{25A1}",
1156 b"squf" | b"squarf" | b"blacksquare" | b"FilledVerySmallSquare" => "\u{25AA}",
1157 b"EmptyVerySmallSquare" => "\u{25AB}",
1158 b"rect" => "\u{25AD}",
1159 b"marker" => "\u{25AE}",
1160 b"fltns" => "\u{25B1}",
1161 b"xutri" | b"bigtriangleup" => "\u{25B3}",
1162 b"utrif" | b"blacktriangle" => "\u{25B4}",
1163 b"utri" | b"triangle" => "\u{25B5}",
1164 b"rtrif" | b"blacktriangleright" => "\u{25B8}",
1165 b"rtri" | b"triangleright" => "\u{25B9}",
1166 b"xdtri" | b"bigtriangledown" => "\u{25BD}",
1167 b"dtrif" | b"blacktriangledown" => "\u{25BE}",
1168 b"dtri" | b"triangledown" => "\u{25BF}",
1169 b"ltrif" | b"blacktriangleleft" => "\u{25C2}",
1170 b"ltri" | b"triangleleft" => "\u{25C3}",
1171 b"loz" | b"lozenge" => "\u{25CA}",
1172 b"cir" => "\u{25CB}",
1173 b"tridot" => "\u{25EC}",
1174 b"xcirc" | b"bigcirc" => "\u{25EF}",
1175 b"ultri" => "\u{25F8}",
1176 b"urtri" => "\u{25F9}",
1177 b"lltri" => "\u{25FA}",
1178 b"EmptySmallSquare" => "\u{25FB}",
1179 b"FilledSmallSquare" => "\u{25FC}",
1180 b"starf" | b"bigstar" => "\u{2605}",
1181 b"star" => "\u{2606}",
1182 b"phone" => "\u{260E}",
1183 b"female" => "\u{2640}",
1184 b"male" => "\u{2642}",
1185 b"spades" | b"spadesuit" => "\u{2660}",
1186 b"clubs" | b"clubsuit" => "\u{2663}",
1187 b"hearts" | b"heartsuit" => "\u{2665}",
1188 b"diams" | b"diamondsuit" => "\u{2666}",
1189 b"sung" => "\u{266A}",
1190 b"flat" => "\u{266D}",
1191 b"natur" | b"natural" => "\u{266E}",
1192 b"sharp" => "\u{266F}",
1193 b"check" | b"checkmark" => "\u{2713}",
1194 b"cross" => "\u{2717}",
1195 b"malt" | b"maltese" => "\u{2720}",
1196 b"sext" => "\u{2736}",
1197 b"VerticalSeparator" => "\u{2758}",
1198 b"lbbrk" => "\u{2772}",
1199 b"rbbrk" => "\u{2773}",
1200 b"lobrk" | b"LeftDoubleBracket" => "\u{27E6}",
1201 b"robrk" | b"RightDoubleBracket" => "\u{27E7}",
1202 b"lang" | b"LeftAngleBracket" | b"langle" => "\u{27E8}",
1203 b"rang" | b"RightAngleBracket" | b"rangle" => "\u{27E9}",
1204 b"Lang" => "\u{27EA}",
1205 b"Rang" => "\u{27EB}",
1206 b"loang" => "\u{27EC}",
1207 b"roang" => "\u{27ED}",
1208 b"xlarr" | b"longleftarrow" | b"LongLeftArrow" => "\u{27F5}",
1209 b"xrarr" | b"longrightarrow" | b"LongRightArrow" => "\u{27F6}",
1210 b"xharr" | b"longleftrightarrow" | b"LongLeftRightArrow" => "\u{27F7}",
1211 b"xlArr" | b"Longleftarrow" | b"DoubleLongLeftArrow" => "\u{27F8}",
1212 b"xrArr" | b"Longrightarrow" | b"DoubleLongRightArrow" => "\u{27F9}",
1213 b"xhArr" | b"Longleftrightarrow" | b"DoubleLongLeftRightArrow" => "\u{27FA}",
1214 b"xmap" | b"longmapsto" => "\u{27FC}",
1215 b"dzigrarr" => "\u{27FF}",
1216 b"nvlArr" => "\u{2902}",
1217 b"nvrArr" => "\u{2903}",
1218 b"nvHarr" => "\u{2904}",
1219 b"Map" => "\u{2905}",
1220 b"lbarr" => "\u{290C}",
1221 b"rbarr" | b"bkarow" => "\u{290D}",
1222 b"lBarr" => "\u{290E}",
1223 b"rBarr" | b"dbkarow" => "\u{290F}",
1224 b"RBarr" | b"drbkarow" => "\u{2910}",
1225 b"DDotrahd" => "\u{2911}",
1226 b"UpArrowBar" => "\u{2912}",
1227 b"DownArrowBar" => "\u{2913}",
1228 b"Rarrtl" => "\u{2916}",
1229 b"latail" => "\u{2919}",
1230 b"ratail" => "\u{291A}",
1231 b"lAtail" => "\u{291B}",
1232 b"rAtail" => "\u{291C}",
1233 b"larrfs" => "\u{291D}",
1234 b"rarrfs" => "\u{291E}",
1235 b"larrbfs" => "\u{291F}",
1236 b"rarrbfs" => "\u{2920}",
1237 b"nwarhk" => "\u{2923}",
1238 b"nearhk" => "\u{2924}",
1239 b"searhk" | b"hksearow" => "\u{2925}",
1240 b"swarhk" | b"hkswarow" => "\u{2926}",
1241 b"nwnear" => "\u{2927}",
1242 b"nesear" | b"toea" => "\u{2928}",
1243 b"seswar" | b"tosa" => "\u{2929}",
1244 b"swnwar" => "\u{292A}",
1245 b"rarrc" => "\u{2933}",
1246 b"cudarrr" => "\u{2935}",
1247 b"ldca" => "\u{2936}",
1248 b"rdca" => "\u{2937}",
1249 b"cudarrl" => "\u{2938}",
1250 b"larrpl" => "\u{2939}",
1251 b"curarrm" => "\u{293C}",
1252 b"cularrp" => "\u{293D}",
1253 b"rarrpl" => "\u{2945}",
1254 b"harrcir" => "\u{2948}",
1255 b"Uarrocir" => "\u{2949}",
1256 b"lurdshar" => "\u{294A}",
1257 b"ldrushar" => "\u{294B}",
1258 b"LeftRightVector" => "\u{294E}",
1259 b"RightUpDownVector" => "\u{294F}",
1260 b"DownLeftRightVector" => "\u{2950}",
1261 b"LeftUpDownVector" => "\u{2951}",
1262 b"LeftVectorBar" => "\u{2952}",
1263 b"RightVectorBar" => "\u{2953}",
1264 b"RightUpVectorBar" => "\u{2954}",
1265 b"RightDownVectorBar" => "\u{2955}",
1266 b"DownLeftVectorBar" => "\u{2956}",
1267 b"DownRightVectorBar" => "\u{2957}",
1268 b"LeftUpVectorBar" => "\u{2958}",
1269 b"LeftDownVectorBar" => "\u{2959}",
1270 b"LeftTeeVector" => "\u{295A}",
1271 b"RightTeeVector" => "\u{295B}",
1272 b"RightUpTeeVector" => "\u{295C}",
1273 b"RightDownTeeVector" => "\u{295D}",
1274 b"DownLeftTeeVector" => "\u{295E}",
1275 b"DownRightTeeVector" => "\u{295F}",
1276 b"LeftUpTeeVector" => "\u{2960}",
1277 b"LeftDownTeeVector" => "\u{2961}",
1278 b"lHar" => "\u{2962}",
1279 b"uHar" => "\u{2963}",
1280 b"rHar" => "\u{2964}",
1281 b"dHar" => "\u{2965}",
1282 b"luruhar" => "\u{2966}",
1283 b"ldrdhar" => "\u{2967}",
1284 b"ruluhar" => "\u{2968}",
1285 b"rdldhar" => "\u{2969}",
1286 b"lharul" => "\u{296A}",
1287 b"llhard" => "\u{296B}",
1288 b"rharul" => "\u{296C}",
1289 b"lrhard" => "\u{296D}",
1290 b"udhar" | b"UpEquilibrium" => "\u{296E}",
1291 b"duhar" | b"ReverseUpEquilibrium" => "\u{296F}",
1292 b"RoundImplies" => "\u{2970}",
1293 b"erarr" => "\u{2971}",
1294 b"simrarr" => "\u{2972}",
1295 b"larrsim" => "\u{2973}",
1296 b"rarrsim" => "\u{2974}",
1297 b"rarrap" => "\u{2975}",
1298 b"ltlarr" => "\u{2976}",
1299 b"gtrarr" => "\u{2978}",
1300 b"subrarr" => "\u{2979}",
1301 b"suplarr" => "\u{297B}",
1302 b"lfisht" => "\u{297C}",
1303 b"rfisht" => "\u{297D}",
1304 b"ufisht" => "\u{297E}",
1305 b"dfisht" => "\u{297F}",
1306 b"lopar" => "\u{2985}",
1307 b"ropar" => "\u{2986}",
1308 b"lbrke" => "\u{298B}",
1309 b"rbrke" => "\u{298C}",
1310 b"lbrkslu" => "\u{298D}",
1311 b"rbrksld" => "\u{298E}",
1312 b"lbrksld" => "\u{298F}",
1313 b"rbrkslu" => "\u{2990}",
1314 b"langd" => "\u{2991}",
1315 b"rangd" => "\u{2992}",
1316 b"lparlt" => "\u{2993}",
1317 b"rpargt" => "\u{2994}",
1318 b"gtlPar" => "\u{2995}",
1319 b"ltrPar" => "\u{2996}",
1320 b"vzigzag" => "\u{299A}",
1321 b"vangrt" => "\u{299C}",
1322 b"angrtvbd" => "\u{299D}",
1323 b"ange" => "\u{29A4}",
1324 b"range" => "\u{29A5}",
1325 b"dwangle" => "\u{29A6}",
1326 b"uwangle" => "\u{29A7}",
1327 b"angmsdaa" => "\u{29A8}",
1328 b"angmsdab" => "\u{29A9}",
1329 b"angmsdac" => "\u{29AA}",
1330 b"angmsdad" => "\u{29AB}",
1331 b"angmsdae" => "\u{29AC}",
1332 b"angmsdaf" => "\u{29AD}",
1333 b"angmsdag" => "\u{29AE}",
1334 b"angmsdah" => "\u{29AF}",
1335 b"bemptyv" => "\u{29B0}",
1336 b"demptyv" => "\u{29B1}",
1337 b"cemptyv" => "\u{29B2}",
1338 b"raemptyv" => "\u{29B3}",
1339 b"laemptyv" => "\u{29B4}",
1340 b"ohbar" => "\u{29B5}",
1341 b"omid" => "\u{29B6}",
1342 b"opar" => "\u{29B7}",
1343 b"operp" => "\u{29B9}",
1344 b"olcross" => "\u{29BB}",
1345 b"odsold" => "\u{29BC}",
1346 b"olcir" => "\u{29BE}",
1347 b"ofcir" => "\u{29BF}",
1348 b"olt" => "\u{29C0}",
1349 b"ogt" => "\u{29C1}",
1350 b"cirscir" => "\u{29C2}",
1351 b"cirE" => "\u{29C3}",
1352 b"solb" => "\u{29C4}",
1353 b"bsolb" => "\u{29C5}",
1354 b"boxbox" => "\u{29C9}",
1355 b"trisb" => "\u{29CD}",
1356 b"rtriltri" => "\u{29CE}",
1357 b"LeftTriangleBar" => "\u{29CF}",
1358 b"RightTriangleBar" => "\u{29D0}",
1359 b"race" => "\u{29DA}",
1360 b"iinfin" => "\u{29DC}",
1361 b"infintie" => "\u{29DD}",
1362 b"nvinfin" => "\u{29DE}",
1363 b"eparsl" => "\u{29E3}",
1364 b"smeparsl" => "\u{29E4}",
1365 b"eqvparsl" => "\u{29E5}",
1366 b"lozf" | b"blacklozenge" => "\u{29EB}",
1367 b"RuleDelayed" => "\u{29F4}",
1368 b"dsol" => "\u{29F6}",
1369 b"xodot" | b"bigodot" => "\u{2A00}",
1370 b"xoplus" | b"bigoplus" => "\u{2A01}",
1371 b"xotime" | b"bigotimes" => "\u{2A02}",
1372 b"xuplus" | b"biguplus" => "\u{2A04}",
1373 b"xsqcup" | b"bigsqcup" => "\u{2A06}",
1374 b"qint" | b"iiiint" => "\u{2A0C}",
1375 b"fpartint" => "\u{2A0D}",
1376 b"cirfnint" => "\u{2A10}",
1377 b"awint" => "\u{2A11}",
1378 b"rppolint" => "\u{2A12}",
1379 b"scpolint" => "\u{2A13}",
1380 b"npolint" => "\u{2A14}",
1381 b"pointint" => "\u{2A15}",
1382 b"quatint" => "\u{2A16}",
1383 b"intlarhk" => "\u{2A17}",
1384 b"pluscir" => "\u{2A22}",
1385 b"plusacir" => "\u{2A23}",
1386 b"simplus" => "\u{2A24}",
1387 b"plusdu" => "\u{2A25}",
1388 b"plussim" => "\u{2A26}",
1389 b"plustwo" => "\u{2A27}",
1390 b"mcomma" => "\u{2A29}",
1391 b"minusdu" => "\u{2A2A}",
1392 b"loplus" => "\u{2A2D}",
1393 b"roplus" => "\u{2A2E}",
1394 b"Cross" => "\u{2A2F}",
1395 b"timesd" => "\u{2A30}",
1396 b"timesbar" => "\u{2A31}",
1397 b"smashp" => "\u{2A33}",
1398 b"lotimes" => "\u{2A34}",
1399 b"rotimes" => "\u{2A35}",
1400 b"otimesas" => "\u{2A36}",
1401 b"Otimes" => "\u{2A37}",
1402 b"odiv" => "\u{2A38}",
1403 b"triplus" => "\u{2A39}",
1404 b"triminus" => "\u{2A3A}",
1405 b"tritime" => "\u{2A3B}",
1406 b"iprod" | b"intprod" => "\u{2A3C}",
1407 b"amalg" => "\u{2A3F}",
1408 b"capdot" => "\u{2A40}",
1409 b"ncup" => "\u{2A42}",
1410 b"ncap" => "\u{2A43}",
1411 b"capand" => "\u{2A44}",
1412 b"cupor" => "\u{2A45}",
1413 b"cupcap" => "\u{2A46}",
1414 b"capcup" => "\u{2A47}",
1415 b"cupbrcap" => "\u{2A48}",
1416 b"capbrcup" => "\u{2A49}",
1417 b"cupcup" => "\u{2A4A}",
1418 b"capcap" => "\u{2A4B}",
1419 b"ccups" => "\u{2A4C}",
1420 b"ccaps" => "\u{2A4D}",
1421 b"ccupssm" => "\u{2A50}",
1422 b"And" => "\u{2A53}",
1423 b"Or" => "\u{2A54}",
1424 b"andand" => "\u{2A55}",
1425 b"oror" => "\u{2A56}",
1426 b"orslope" => "\u{2A57}",
1427 b"andslope" => "\u{2A58}",
1428 b"andv" => "\u{2A5A}",
1429 b"orv" => "\u{2A5B}",
1430 b"andd" => "\u{2A5C}",
1431 b"ord" => "\u{2A5D}",
1432 b"wedbar" => "\u{2A5F}",
1433 b"sdote" => "\u{2A66}",
1434 b"simdot" => "\u{2A6A}",
1435 b"congdot" => "\u{2A6D}",
1436 b"easter" => "\u{2A6E}",
1437 b"apacir" => "\u{2A6F}",
1438 b"apE" => "\u{2A70}",
1439 b"eplus" => "\u{2A71}",
1440 b"pluse" => "\u{2A72}",
1441 b"Esim" => "\u{2A73}",
1442 b"Colone" => "\u{2A74}",
1443 b"Equal" => "\u{2A75}",
1444 b"eDDot" | b"ddotseq" => "\u{2A77}",
1445 b"equivDD" => "\u{2A78}",
1446 b"ltcir" => "\u{2A79}",
1447 b"gtcir" => "\u{2A7A}",
1448 b"ltquest" => "\u{2A7B}",
1449 b"gtquest" => "\u{2A7C}",
1450 b"les" | b"LessSlantEqual" | b"leqslant" => "\u{2A7D}",
1451 b"ges" | b"GreaterSlantEqual" | b"geqslant" => "\u{2A7E}",
1452 b"lesdot" => "\u{2A7F}",
1453 b"gesdot" => "\u{2A80}",
1454 b"lesdoto" => "\u{2A81}",
1455 b"gesdoto" => "\u{2A82}",
1456 b"lesdotor" => "\u{2A83}",
1457 b"gesdotol" => "\u{2A84}",
1458 b"lap" | b"lessapprox" => "\u{2A85}",
1459 b"gap" | b"gtrapprox" => "\u{2A86}",
1460 b"lne" | b"lneq" => "\u{2A87}",
1461 b"gne" | b"gneq" => "\u{2A88}",
1462 b"lnap" | b"lnapprox" => "\u{2A89}",
1463 b"gnap" | b"gnapprox" => "\u{2A8A}",
1464 b"lEg" | b"lesseqqgtr" => "\u{2A8B}",
1465 b"gEl" | b"gtreqqless" => "\u{2A8C}",
1466 b"lsime" => "\u{2A8D}",
1467 b"gsime" => "\u{2A8E}",
1468 b"lsimg" => "\u{2A8F}",
1469 b"gsiml" => "\u{2A90}",
1470 b"lgE" => "\u{2A91}",
1471 b"glE" => "\u{2A92}",
1472 b"lesges" => "\u{2A93}",
1473 b"gesles" => "\u{2A94}",
1474 b"els" | b"eqslantless" => "\u{2A95}",
1475 b"egs" | b"eqslantgtr" => "\u{2A96}",
1476 b"elsdot" => "\u{2A97}",
1477 b"egsdot" => "\u{2A98}",
1478 b"el" => "\u{2A99}",
1479 b"eg" => "\u{2A9A}",
1480 b"siml" => "\u{2A9D}",
1481 b"simg" => "\u{2A9E}",
1482 b"simlE" => "\u{2A9F}",
1483 b"simgE" => "\u{2AA0}",
1484 b"LessLess" => "\u{2AA1}",
1485 b"GreaterGreater" => "\u{2AA2}",
1486 b"glj" => "\u{2AA4}",
1487 b"gla" => "\u{2AA5}",
1488 b"ltcc" => "\u{2AA6}",
1489 b"gtcc" => "\u{2AA7}",
1490 b"lescc" => "\u{2AA8}",
1491 b"gescc" => "\u{2AA9}",
1492 b"smt" => "\u{2AAA}",
1493 b"lat" => "\u{2AAB}",
1494 b"smte" => "\u{2AAC}",
1495 b"late" => "\u{2AAD}",
1496 b"bumpE" => "\u{2AAE}",
1497 b"pre" | b"preceq" | b"PrecedesEqual" => "\u{2AAF}",
1498 b"sce" | b"succeq" | b"SucceedsEqual" => "\u{2AB0}",
1499 b"prE" => "\u{2AB3}",
1500 b"scE" => "\u{2AB4}",
1501 b"prnE" | b"precneqq" => "\u{2AB5}",
1502 b"scnE" | b"succneqq" => "\u{2AB6}",
1503 b"prap" | b"precapprox" => "\u{2AB7}",
1504 b"scap" | b"succapprox" => "\u{2AB8}",
1505 b"prnap" | b"precnapprox" => "\u{2AB9}",
1506 b"scnap" | b"succnapprox" => "\u{2ABA}",
1507 b"Pr" => "\u{2ABB}",
1508 b"Sc" => "\u{2ABC}",
1509 b"subdot" => "\u{2ABD}",
1510 b"supdot" => "\u{2ABE}",
1511 b"subplus" => "\u{2ABF}",
1512 b"supplus" => "\u{2AC0}",
1513 b"submult" => "\u{2AC1}",
1514 b"supmult" => "\u{2AC2}",
1515 b"subedot" => "\u{2AC3}",
1516 b"supedot" => "\u{2AC4}",
1517 b"subE" | b"subseteqq" => "\u{2AC5}",
1518 b"supE" | b"supseteqq" => "\u{2AC6}",
1519 b"subsim" => "\u{2AC7}",
1520 b"supsim" => "\u{2AC8}",
1521 b"subnE" | b"subsetneqq" => "\u{2ACB}",
1522 b"supnE" | b"supsetneqq" => "\u{2ACC}",
1523 b"csub" => "\u{2ACF}",
1524 b"csup" => "\u{2AD0}",
1525 b"csube" => "\u{2AD1}",
1526 b"csupe" => "\u{2AD2}",
1527 b"subsup" => "\u{2AD3}",
1528 b"supsub" => "\u{2AD4}",
1529 b"subsub" => "\u{2AD5}",
1530 b"supsup" => "\u{2AD6}",
1531 b"suphsub" => "\u{2AD7}",
1532 b"supdsub" => "\u{2AD8}",
1533 b"forkv" => "\u{2AD9}",
1534 b"topfork" => "\u{2ADA}",
1535 b"mlcp" => "\u{2ADB}",
1536 b"Dashv" | b"DoubleLeftTee" => "\u{2AE4}",
1537 b"Vdashl" => "\u{2AE6}",
1538 b"Barv" => "\u{2AE7}",
1539 b"vBar" => "\u{2AE8}",
1540 b"vBarv" => "\u{2AE9}",
1541 b"Vbar" => "\u{2AEB}",
1542 b"Not" => "\u{2AEC}",
1543 b"bNot" => "\u{2AED}",
1544 b"rnmid" => "\u{2AEE}",
1545 b"cirmid" => "\u{2AEF}",
1546 b"midcir" => "\u{2AF0}",
1547 b"topcir" => "\u{2AF1}",
1548 b"nhpar" => "\u{2AF2}",
1549 b"parsim" => "\u{2AF3}",
1550 b"parsl" => "\u{2AFD}",
1551 b"fflig" => "\u{FB00}",
1552 b"filig" => "\u{FB01}",
1553 b"fllig" => "\u{FB02}",
1554 b"ffilig" => "\u{FB03}",
1555 b"ffllig" => "\u{FB04}",
1556 b"Ascr" => "\u{1D49}",
1557 b"Cscr" => "\u{1D49}",
1558 b"Dscr" => "\u{1D49}",
1559 b"Gscr" => "\u{1D4A}",
1560 b"Jscr" => "\u{1D4A}",
1561 b"Kscr" => "\u{1D4A}",
1562 b"Nscr" => "\u{1D4A}",
1563 b"Oscr" => "\u{1D4A}",
1564 b"Pscr" => "\u{1D4A}",
1565 b"Qscr" => "\u{1D4A}",
1566 b"Sscr" => "\u{1D4A}",
1567 b"Tscr" => "\u{1D4A}",
1568 b"Uscr" => "\u{1D4B}",
1569 b"Vscr" => "\u{1D4B}",
1570 b"Wscr" => "\u{1D4B}",
1571 b"Xscr" => "\u{1D4B}",
1572 b"Yscr" => "\u{1D4B}",
1573 b"Zscr" => "\u{1D4B}",
1574 b"ascr" => "\u{1D4B}",
1575 b"bscr" => "\u{1D4B}",
1576 b"cscr" => "\u{1D4B}",
1577 b"dscr" => "\u{1D4B}",
1578 b"fscr" => "\u{1D4B}",
1579 b"hscr" => "\u{1D4B}",
1580 b"iscr" => "\u{1D4B}",
1581 b"jscr" => "\u{1D4B}",
1582 b"kscr" => "\u{1D4C}",
1583 b"lscr" => "\u{1D4C}",
1584 b"mscr" => "\u{1D4C}",
1585 b"nscr" => "\u{1D4C}",
1586 b"pscr" => "\u{1D4C}",
1587 b"qscr" => "\u{1D4C}",
1588 b"rscr" => "\u{1D4C}",
1589 b"sscr" => "\u{1D4C}",
1590 b"tscr" => "\u{1D4C}",
1591 b"uscr" => "\u{1D4C}",
1592 b"vscr" => "\u{1D4C}",
1593 b"wscr" => "\u{1D4C}",
1594 b"xscr" => "\u{1D4C}",
1595 b"yscr" => "\u{1D4C}",
1596 b"zscr" => "\u{1D4C}",
1597 b"Afr" => "\u{1D50}",
1598 b"Bfr" => "\u{1D50}",
1599 b"Dfr" => "\u{1D50}",
1600 b"Efr" => "\u{1D50}",
1601 b"Ffr" => "\u{1D50}",
1602 b"Gfr" => "\u{1D50}",
1603 b"Jfr" => "\u{1D50}",
1604 b"Kfr" => "\u{1D50}",
1605 b"Lfr" => "\u{1D50}",
1606 b"Mfr" => "\u{1D51}",
1607 b"Nfr" => "\u{1D51}",
1608 b"Ofr" => "\u{1D51}",
1609 b"Pfr" => "\u{1D51}",
1610 b"Qfr" => "\u{1D51}",
1611 b"Sfr" => "\u{1D51}",
1612 b"Tfr" => "\u{1D51}",
1613 b"Ufr" => "\u{1D51}",
1614 b"Vfr" => "\u{1D51}",
1615 b"Wfr" => "\u{1D51}",
1616 b"Xfr" => "\u{1D51}",
1617 b"Yfr" => "\u{1D51}",
1618 b"afr" => "\u{1D51}",
1619 b"bfr" => "\u{1D51}",
1620 b"cfr" => "\u{1D52}",
1621 b"dfr" => "\u{1D52}",
1622 b"efr" => "\u{1D52}",
1623 b"ffr" => "\u{1D52}",
1624 b"gfr" => "\u{1D52}",
1625 b"hfr" => "\u{1D52}",
1626 b"ifr" => "\u{1D52}",
1627 b"jfr" => "\u{1D52}",
1628 b"kfr" => "\u{1D52}",
1629 b"lfr" => "\u{1D52}",
1630 b"mfr" => "\u{1D52}",
1631 b"nfr" => "\u{1D52}",
1632 b"ofr" => "\u{1D52}",
1633 b"pfr" => "\u{1D52}",
1634 b"qfr" => "\u{1D52}",
1635 b"rfr" => "\u{1D52}",
1636 b"sfr" => "\u{1D53}",
1637 b"tfr" => "\u{1D53}",
1638 b"ufr" => "\u{1D53}",
1639 b"vfr" => "\u{1D53}",
1640 b"wfr" => "\u{1D53}",
1641 b"xfr" => "\u{1D53}",
1642 b"yfr" => "\u{1D53}",
1643 b"zfr" => "\u{1D53}",
1644 b"Aopf" => "\u{1D53}",
1645 b"Bopf" => "\u{1D53}",
1646 b"Dopf" => "\u{1D53}",
1647 b"Eopf" => "\u{1D53}",
1648 b"Fopf" => "\u{1D53}",
1649 b"Gopf" => "\u{1D53}",
1650 b"Iopf" => "\u{1D54}",
1651 b"Jopf" => "\u{1D54}",
1652 b"Kopf" => "\u{1D54}",
1653 b"Lopf" => "\u{1D54}",
1654 b"Mopf" => "\u{1D54}",
1655 b"Oopf" => "\u{1D54}",
1656 b"Sopf" => "\u{1D54}",
1657 b"Topf" => "\u{1D54}",
1658 b"Uopf" => "\u{1D54}",
1659 b"Vopf" => "\u{1D54}",
1660 b"Wopf" => "\u{1D54}",
1661 b"Xopf" => "\u{1D54}",
1662 b"Yopf" => "\u{1D55}",
1663 b"aopf" => "\u{1D55}",
1664 b"bopf" => "\u{1D55}",
1665 b"copf" => "\u{1D55}",
1666 b"dopf" => "\u{1D55}",
1667 b"eopf" => "\u{1D55}",
1668 b"fopf" => "\u{1D55}",
1669 b"gopf" => "\u{1D55}",
1670 b"hopf" => "\u{1D55}",
1671 b"iopf" => "\u{1D55}",
1672 b"jopf" => "\u{1D55}",
1673 b"kopf" => "\u{1D55}",
1674 b"lopf" => "\u{1D55}",
1675 b"mopf" => "\u{1D55}",
1676 b"nopf" => "\u{1D55}",
1677 b"oopf" => "\u{1D56}",
1678 b"popf" => "\u{1D56}",
1679 b"qopf" => "\u{1D56}",
1680 b"ropf" => "\u{1D56}",
1681 b"sopf" => "\u{1D56}",
1682 b"topf" => "\u{1D56}",
1683 b"uopf" => "\u{1D56}",
1684 b"vopf" => "\u{1D56}",
1685 b"wopf" => "\u{1D56}",
1686 b"xopf" => "\u{1D56}",
1687 b"yopf" => "\u{1D56}",
1688 b"zopf" => "\u{1D56}",
1689 _ => return None,
1690 };
1691 Some(s)
1692}
1693
1694fn parse_number(bytes: &str, range: Range<usize>) -> Result<char, EscapeError> {
1695 let code: u32 = if let Some(hex_digits: &str) = bytes.strip_prefix('x') {
1696 parse_hexadecimal(bytes:hex_digits)
1697 } else {
1698 parse_decimal(bytes)
1699 }?;
1700 if code == 0 {
1701 return Err(EscapeError::EntityWithNull(range));
1702 }
1703 match std::char::from_u32(code) {
1704 Some(c: char) => Ok(c),
1705 None => Err(EscapeError::InvalidCodepoint(code)),
1706 }
1707}
1708
1709fn parse_hexadecimal(bytes: &str) -> Result<u32, EscapeError> {
1710 // maximum code is 0x10FFFF => 6 characters
1711 if bytes.len() > 6 {
1712 return Err(EscapeError::TooLongHexadecimal);
1713 }
1714 let mut code: u32 = 0;
1715 for b: u8 in bytes.bytes() {
1716 code <<= 4;
1717 code += match b {
1718 b'0'..=b'9' => b - b'0',
1719 b'a'..=b'f' => b - b'a' + 10,
1720 b'A'..=b'F' => b - b'A' + 10,
1721 b: u8 => return Err(EscapeError::InvalidHexadecimal(b as char)),
1722 } as u32;
1723 }
1724 Ok(code)
1725}
1726
1727fn parse_decimal(bytes: &str) -> Result<u32, EscapeError> {
1728 // maximum code is 0x10FFFF = 1114111 => 7 characters
1729 if bytes.len() > 7 {
1730 return Err(EscapeError::TooLongDecimal);
1731 }
1732 let mut code: u32 = 0;
1733 for b: u8 in bytes.bytes() {
1734 code *= 10;
1735 code += match b {
1736 b'0'..=b'9' => b - b'0',
1737 b: u8 => return Err(EscapeError::InvalidDecimal(b as char)),
1738 } as u32;
1739 }
1740 Ok(code)
1741}
1742
1743#[test]
1744fn test_unescape() {
1745 let unchanged: Cow<'_, str> = unescape(raw:"test").unwrap();
1746 // assert_eq does not check that Cow is borrowed, but we explicitly use Cow
1747 // because it influences diff
1748 // TODO: use assert_matches! when stabilized and other features will bump MSRV
1749 assert_eq!(unchanged, Cow::Borrowed("test"));
1750 assert!(matches!(unchanged, Cow::Borrowed(_)));
1751
1752 assert_eq!(unescape("&lt;test&gt;").unwrap(), "<test>");
1753 assert_eq!(unescape("&#x30;").unwrap(), "0");
1754 assert_eq!(unescape("&#48;").unwrap(), "0");
1755 assert!(unescape("&foo;").is_err());
1756}
1757
1758#[test]
1759fn test_unescape_with() {
1760 let custom_entities: impl Fn(&str) -> Option<&…> = |ent: &str| match ent {
1761 "foo" => Some("BAR"),
1762 _ => None,
1763 };
1764
1765 let unchanged: Cow<'_, str> = unescape_with(raw:"test", resolve_entity:custom_entities).unwrap();
1766 // assert_eq does not check that Cow is borrowed, but we explicitly use Cow
1767 // because it influences diff
1768 // TODO: use assert_matches! when stabilized and other features will bump MSRV
1769 assert_eq!(unchanged, Cow::Borrowed("test"));
1770 assert!(matches!(unchanged, Cow::Borrowed(_)));
1771
1772 assert_eq!(
1773 unescape_with("&lt;test&gt;", custom_entities).unwrap(),
1774 "<test>"
1775 );
1776 assert_eq!(unescape_with("&#x30;", custom_entities).unwrap(), "0");
1777 assert_eq!(unescape_with("&#48;", custom_entities).unwrap(), "0");
1778 assert_eq!(unescape_with("&foo;", custom_entities).unwrap(), "BAR");
1779 assert!(unescape_with("&fop;", custom_entities).is_err());
1780}
1781
1782#[test]
1783fn test_escape() {
1784 let unchanged: Cow<'_, str> = escape(raw:"test");
1785 // assert_eq does not check that Cow is borrowed, but we explicitly use Cow
1786 // because it influences diff
1787 // TODO: use assert_matches! when stabilized and other features will bump MSRV
1788 assert_eq!(unchanged, Cow::Borrowed("test"));
1789 assert!(matches!(unchanged, Cow::Borrowed(_)));
1790
1791 assert_eq!(escape("<test>"), "&lt;test&gt;");
1792 assert_eq!(escape("\"a\"bc"), "&quot;a&quot;bc");
1793 assert_eq!(escape("\"a\"b&c"), "&quot;a&quot;b&amp;c");
1794 assert_eq!(
1795 escape("prefix_\"a\"b&<>c"),
1796 "prefix_&quot;a&quot;b&amp;&lt;&gt;c"
1797 );
1798}
1799
1800#[test]
1801fn test_partial_escape() {
1802 let unchanged: Cow<'_, str> = partial_escape(raw:"test");
1803 // assert_eq does not check that Cow is borrowed, but we explicitly use Cow
1804 // because it influences diff
1805 // TODO: use assert_matches! when stabilized and other features will bump MSRV
1806 assert_eq!(unchanged, Cow::Borrowed("test"));
1807 assert!(matches!(unchanged, Cow::Borrowed(_)));
1808
1809 assert_eq!(partial_escape("<test>"), "&lt;test&gt;");
1810 assert_eq!(partial_escape("\"a\"bc"), "\"a\"bc");
1811 assert_eq!(partial_escape("\"a\"b&c"), "\"a\"b&amp;c");
1812 assert_eq!(
1813 partial_escape("prefix_\"a\"b&<>c"),
1814 "prefix_\"a\"b&amp;&lt;&gt;c"
1815 );
1816}
1817