text
stringlengths
0
357
"aacute;", "á", "acirc;", "â", "atilde;", "ã", "auml;", "ä",
"aring;", "å", "aelig;", "æ", "ccedil;", "ç", "egrave;", "è",
"eacute;", "é", "ecirc;", "ê", "euml;", "ë", "igrave;", "ì",
"iacute;", "í", "icirc;", "î", "iuml;", "ï", "eth;", "ð",
"ntilde;", "ñ", "ograve;", "ò", "oacute;", "ó", "ocirc;", "ô",
"otilde;", "õ", "ouml;", "ö", "divide;", "÷", "oslash;", "ø",
"ugrave;", "ù", "uacute;", "ú", "ucirc;", "û", "uuml;", "ü",
"yacute;", "ý", "thorn;", "þ", "yuml;", "ÿ", "OElig;", "Œ",
"oelig;", "œ", "Scaron;", "Š", "scaron;", "š", "Yuml;", "Ÿ",
"fnof;", "ƒ", "circ;", "ˆ", "tilde;", "˜", "Alpha;", "Α",
"Beta;", "Β", "Gamma;", "Γ", "Delta;", "Δ", "Epsilon;", "Ε",
"Zeta;", "Ζ", "Eta;", "Η", "Theta;", "Θ", "Iota;", "Ι",
"Kappa;", "Κ", "Lambda;", "Λ", "Mu;", "Μ", "Nu;", "Ν",
"Xi;", "Ξ", "Omicron;", "Ο", "Pi;", "Π", "Rho;", "Ρ",
"Sigma;", "Σ", "Tau;", "Τ", "Upsilon;", "Υ", "Phi;", "Φ",
"Chi;", "Χ", "Psi;", "Ψ", "Omega;", "Ω", "alpha;", "α",
"beta;", "β", "gamma;", "γ", "delta;", "δ", "epsilon;", "ε",
"zeta;", "ζ", "eta;", "η", "theta;", "θ", "iota;", "ι",
"kappa;", "κ", "lambda;", "λ", "mu;", "μ", "nu;", "ν",
"xi;", "ξ", "omicron;", "ο", "pi;", "π", "rho;", "ρ",
"sigmaf;", "ς", "sigma;", "σ", "tau;", "τ", "upsilon;", "υ",
"phi;", "φ", "chi;", "χ", "psi;", "ψ", "omega;", "ω",
"thetasym;","ϑ", "upsih;", "ϒ", "piv;", "ϖ", "ensp;", " ",
"emsp;", " ", "thinsp;", " ", "zwnj;", "" , "zwj;", "" ,
"lrm;", "" , "rlm;", "" , "ndash;", "–", "mdash;", "—",
"lsquo;", "‘", "rsquo;", "’", "sbquo;", "‚", "ldquo;", "“",
"rdquo;", "”", "bdquo;", "„", "dagger;", "†", "Dagger;", "‡",
"bull;", "•", "hellip;", "…", "permil;", "‰", "prime;", "′",
"Prime;", "″", "lsaquo;", "‹", "rsaquo;", "›", "oline;", "‾",
"frasl;", "⁄", "euro;", "€", "image;", "ℑ", "weierp;", "℘",
"real;", "ℜ", "trade;", "™", "alefsym;", "ℵ", "larr;", "←",
"uarr;", "↑", "rarr;", "→", "darr;", "↓", "harr;", "↔",
"crarr;", "↵", "lArr;", "⇐", "uArr;", "⇑", "rArr;", "⇒",
"dArr;", "⇓", "hArr;", "⇔", "forall;", "∀", "part;", "∂",
"exist;", "∃", "empty;", "∅", "nabla;", "∇", "isin;", "∈",
"notin;", "∉", "ni;", "∋", "prod;", "∏", "sum;", "∑",
"minus;", "−", "lowast;", "∗", "radic;", "√", "prop;", "∝",
"infin;", "∞", "ang;", "∠", "and;", "∧", "or;", "∨",
"cap;", "∩", "cup;", "∪", "int;", "∫", "there4;", "∴",
"sim;", "∼", "cong;", "≅", "asymp;", "≈", "ne;", "≠",
"equiv;", "≡", "le;", "≤", "ge;", "≥", "sub;", "⊂",
"sup;", "⊃", "nsub;", "⊄", "sube;", "⊆", "supe;", "⊇",
"oplus;", "⊕", "otimes;", "⊗", "perp;", "⊥", "sdot;", "⋅",
"lceil;", "⌈", "rceil;", "⌉", "lfloor;", "⌊", "rfloor;", "⌋",
"lang;", "<", "rang;", ">", "loz;", "◊", "spades;", "♠",
"clubs;", "♣", "hearts;", "♥", "diams;", "♦",
/* MUST be last */
NULL, NULL,
};
/* Recursively decodes entity and character references and normalizes new lines.
set "type" to ...
'&' for general entity decoding,
'%' for parameter entity decoding (currently not needed),
'c' for cdata sections,
' ' for attribute normalization, or
'*' for non-cdata attribute normalization (currently not needed).
Returns s, or if the decoded string is longer than s, returns a malloced string
that must be freed.
Function based upon ezxml_decode() from the "ezxml" parser which is
Copyright 2004-2006 Aaron Voisine <aaron@voisine.org> */
static char* xml_decode(char* s, char type)
{
char* e = NULL;
char* r = s;
const char* original_buf = s;
long b = 0;
long c = 0;
long d = 0;
long l = 0;
for (; *s; s++) { /* normalize line endings */
while (*s == '\r') {
*(s++) = '\n';
if (*s == '\n') memmove(s, (s + 1), strlen(s));
}
}
for (s = r; ;) {
while (*s && *s != '&' /*&& (*s != '%' || type != '%')*/ && !isspace(*s)) s++;
if (! *s)
{
break;
}
else if (type != 'c' && ! strncmp(s, "&#", 2))
{
/* character reference */
if (s[2] == 'x') c = strtol(s + 3, &e, 16); /* base 16 */
else c = strtol(s + 2, &e, 10); /* base 10 */
if (! c || *e != ';') { s++; continue; } /* not a character ref */
if (c < 0x80) *(s++) = c; /* US-ASCII subset */
else { /* multi-byte UTF-8 sequence */
for (b = 0, d = c; d; d /= 2) b++; /* number of bits in c */
b = (b - 2) / 5; /* number of bytes in payload */
*(s++) = (0xFF << (7 - b)) | (c >> (6 * b)); /* head */
while (b) *(s++) = 0x80 | ((c >> (6 * --b)) & 0x3F); /* payload */