Mar 5, 2010 at 10:15pm UTC
I'm writing a simple web crawler, and I need to create files based on information I get from an HTML file. The problem is that I don't want to create files named
"foo" .
"foo" is what I'm looking for.
Does anyone know of a reference with a simple HTML character entities to UCS conversion table that can be easily processed by a computer? Ideally, an entry should look something like ""\t0022".
EDIT: Damn. Every time I ask a question, I end up finding the answer five second later.
Here's a processed table, in case anyone needs it:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201
std::map<std::string,wchar_t > entities;
entities["quot" ]=(wchar_t )0x0022;
entities["amp" ]=(wchar_t )0x0026;
entities["apos" ]=(wchar_t )0x0027;
entities["lt" ]=(wchar_t )0x003C;
entities["gt" ]=(wchar_t )0x003E;
entities["nbsp" ]=(wchar_t )0x00A0;
entities["iexcl" ]=(wchar_t )0x00A1;
entities["cent" ]=(wchar_t )0x00A2;
entities["pound" ]=(wchar_t )0x00A3;
entities["curren" ]=(wchar_t )0x00A4;
entities["yen" ]=(wchar_t )0x00A5;
entities["brvbar" ]=(wchar_t )0x00A6;
entities["sect" ]=(wchar_t )0x00A7;
entities["uml" ]=(wchar_t )0x00A8;
entities["copy" ]=(wchar_t )0x00A9;
entities["ordf" ]=(wchar_t )0x00AA;
entities["laquo" ]=(wchar_t )0x00AB;
entities["not" ]=(wchar_t )0x00AC;
entities["shy" ]=(wchar_t )0x00AD;
entities["reg" ]=(wchar_t )0x00AE;
entities["macr" ]=(wchar_t )0x00AF;
entities["deg" ]=(wchar_t )0x00B0;
entities["plusmn" ]=(wchar_t )0x00B1;
entities["sup2" ]=(wchar_t )0x00B2;
entities["sup3" ]=(wchar_t )0x00B3;
entities["acute" ]=(wchar_t )0x00B4;
entities["micro" ]=(wchar_t )0x00B5;
entities["para" ]=(wchar_t )0x00B6;
entities["middot" ]=(wchar_t )0x00B7;
entities["cedil" ]=(wchar_t )0x00B8;
entities["sup1" ]=(wchar_t )0x00B9;
entities["ordm" ]=(wchar_t )0x00BA;
entities["raquo" ]=(wchar_t )0x00BB;
entities["frac14" ]=(wchar_t )0x00BC;
entities["frac12" ]=(wchar_t )0x00BD;
entities["frac34" ]=(wchar_t )0x00BE;
entities["iquest" ]=(wchar_t )0x00BF;
entities["Agrave" ]=(wchar_t )0x00C0;
entities["Aacute" ]=(wchar_t )0x00C1;
entities["Acirc" ]=(wchar_t )0x00C2;
entities["Atilde" ]=(wchar_t )0x00C3;
entities["Auml" ]=(wchar_t )0x00C4;
entities["Aring" ]=(wchar_t )0x00C5;
entities["AElig" ]=(wchar_t )0x00C6;
entities["Ccedil" ]=(wchar_t )0x00C7;
entities["Egrave" ]=(wchar_t )0x00C8;
entities["Eacute" ]=(wchar_t )0x00C9;
entities["Ecirc" ]=(wchar_t )0x00CA;
entities["Euml" ]=(wchar_t )0x00CB;
entities["Igrave" ]=(wchar_t )0x00CC;
entities["Iacute" ]=(wchar_t )0x00CD;
entities["Icirc" ]=(wchar_t )0x00CE;
entities["Iuml" ]=(wchar_t )0x00CF;
entities["ETH" ]=(wchar_t )0x00D0;
entities["Ntilde" ]=(wchar_t )0x00D1;
entities["Ograve" ]=(wchar_t )0x00D2;
entities["Oacute" ]=(wchar_t )0x00D3;
entities["Ocirc" ]=(wchar_t )0x00D4;
entities["Otilde" ]=(wchar_t )0x00D5;
entities["Ouml" ]=(wchar_t )0x00D6;
entities["times" ]=(wchar_t )0x00D7;
entities["Oslash" ]=(wchar_t )0x00D8;
entities["Ugrave" ]=(wchar_t )0x00D9;
entities["Uacute" ]=(wchar_t )0x00DA;
entities["Ucirc" ]=(wchar_t )0x00DB;
entities["Uuml" ]=(wchar_t )0x00DC;
entities["Yacute" ]=(wchar_t )0x00DD;
entities["THORN" ]=(wchar_t )0x00DE;
entities["szlig" ]=(wchar_t )0x00DF;
entities["agrave" ]=(wchar_t )0x00E0;
entities["aacute" ]=(wchar_t )0x00E1;
entities["acirc" ]=(wchar_t )0x00E2;
entities["atilde" ]=(wchar_t )0x00E3;
entities["auml" ]=(wchar_t )0x00E4;
entities["aring" ]=(wchar_t )0x00E5;
entities["aelig" ]=(wchar_t )0x00E6;
entities["ccedil" ]=(wchar_t )0x00E7;
entities["egrave" ]=(wchar_t )0x00E8;
entities["eacute" ]=(wchar_t )0x00E9;
entities["ecirc" ]=(wchar_t )0x00EA;
entities["euml" ]=(wchar_t )0x00EB;
entities["igrave" ]=(wchar_t )0x00EC;
entities["iacute" ]=(wchar_t )0x00ED;
entities["icirc" ]=(wchar_t )0x00EE;
entities["iuml" ]=(wchar_t )0x00EF;
entities["eth" ]=(wchar_t )0x00F0;
entities["ntilde" ]=(wchar_t )0x00F1;
entities["ograve" ]=(wchar_t )0x00F2;
entities["oacute" ]=(wchar_t )0x00F3;
entities["ocirc" ]=(wchar_t )0x00F4;
entities["otilde" ]=(wchar_t )0x00F5;
entities["ouml" ]=(wchar_t )0x00F6;
entities["divide" ]=(wchar_t )0x00F7;
entities["oslash" ]=(wchar_t )0x00F8;
entities["ugrave" ]=(wchar_t )0x00F9;
entities["uacute" ]=(wchar_t )0x00FA;
entities["ucirc" ]=(wchar_t )0x00FB;
entities["uuml" ]=(wchar_t )0x00FC;
entities["yacute" ]=(wchar_t )0x00FD;
entities["thorn" ]=(wchar_t )0x00FE;
entities["yuml" ]=(wchar_t )0x00FF;
entities["OElig" ]=(wchar_t )0x0152;
entities["oelig" ]=(wchar_t )0x0153;
entities["Scaron" ]=(wchar_t )0x0160;
entities["scaron" ]=(wchar_t )0x0161;
entities["Yuml" ]=(wchar_t )0x0178;
entities["fnof" ]=(wchar_t )0x0192;
entities["circ" ]=(wchar_t )0x02C6;
entities["tilde" ]=(wchar_t )0x02DC;
entities["Alpha" ]=(wchar_t )0x0391;
entities["Beta" ]=(wchar_t )0x0392;
entities["Gamma" ]=(wchar_t )0x0393;
entities["Delta" ]=(wchar_t )0x0394;
entities["Epsilon" ]=(wchar_t )0x0395;
entities["Zeta" ]=(wchar_t )0x0396;
entities["Eta" ]=(wchar_t )0x0397;
entities["Theta" ]=(wchar_t )0x0398;
entities["Iota" ]=(wchar_t )0x0399;
entities["Kappa" ]=(wchar_t )0x039A;
entities["Lambda" ]=(wchar_t )0x039B;
entities["Mu" ]=(wchar_t )0x039C;
entities["Nu" ]=(wchar_t )0x039D;
entities["Xi" ]=(wchar_t )0x039E;
entities["Omicron" ]=(wchar_t )0x039F;
entities["Pi" ]=(wchar_t )0x03A0;
entities["Rho" ]=(wchar_t )0x03A1;
entities["Sigma" ]=(wchar_t )0x03A3;
entities["Tau" ]=(wchar_t )0x03A4;
entities["Upsilon" ]=(wchar_t )0x03A5;
entities["Phi" ]=(wchar_t )0x03A6;
entities["Chi" ]=(wchar_t )0x03A7;
entities["Psi" ]=(wchar_t )0x03A8;
entities["Omega" ]=(wchar_t )0x03A9;
entities["alpha" ]=(wchar_t )0x03B1;
entities["beta" ]=(wchar_t )0x03B2;
entities["gamma" ]=(wchar_t )0x03B3;
entities["delta" ]=(wchar_t )0x03B4;
entities["epsilon" ]=(wchar_t )0x03B5;
entities["zeta" ]=(wchar_t )0x03B6;
entities["eta" ]=(wchar_t )0x03B7;
entities["theta" ]=(wchar_t )0x03B8;
entities["iota" ]=(wchar_t )0x03B9;
entities["kappa" ]=(wchar_t )0x03BA;
entities["lambda" ]=(wchar_t )0x03BB;
entities["mu" ]=(wchar_t )0x03BC;
entities["nu" ]=(wchar_t )0x03BD;
entities["xi" ]=(wchar_t )0x03BE;
entities["omicron" ]=(wchar_t )0x03BF;
entities["pi" ]=(wchar_t )0x03C0;
entities["rho" ]=(wchar_t )0x03C1;
entities["sigmaf" ]=(wchar_t )0x03C2;
entities["sigma" ]=(wchar_t )0x03C3;
entities["tau" ]=(wchar_t )0x03C4;
entities["upsilon" ]=(wchar_t )0x03C5;
entities["phi" ]=(wchar_t )0x03C6;
entities["chi" ]=(wchar_t )0x03C7;
entities["psi" ]=(wchar_t )0x03C8;
entities["omega" ]=(wchar_t )0x03C9;
entities["thetasym" ]=(wchar_t )0x03D1;
entities["upsih" ]=(wchar_t )0x03D2;
entities["piv" ]=(wchar_t )0x03D6;
entities["ensp" ]=(wchar_t )0x2002;
entities["emsp" ]=(wchar_t )0x2003;
entities["thinsp" ]=(wchar_t )0x2009;
entities["zwnj" ]=(wchar_t )0x200C;
entities["zwj" ]=(wchar_t )0x200D;
entities["lrm" ]=(wchar_t )0x200E;
entities["rlm" ]=(wchar_t )0x200F;
entities["ndash" ]=(wchar_t )0x2013;
entities["mdash" ]=(wchar_t )0x2014;
entities["lsquo" ]=(wchar_t )0x2018;
entities["rsquo" ]=(wchar_t )0x2019;
entities["sbquo" ]=(wchar_t )0x201A;
entities["ldquo" ]=(wchar_t )0x201C;
entities["rdquo" ]=(wchar_t )0x201D;
entities["bdquo" ]=(wchar_t )0x201E;
entities["dagger" ]=(wchar_t )0x2020;
entities["Dagger" ]=(wchar_t )0x2021;
entities["bull" ]=(wchar_t )0x2022;
entities["hellip" ]=(wchar_t )0x2026;
entities["permil" ]=(wchar_t )0x2030;
entities["prime" ]=(wchar_t )0x2032;
entities["Prime" ]=(wchar_t )0x2033;
entities["lsaquo" ]=(wchar_t )0x2039;
entities["rsaquo" ]=(wchar_t )0x203A;
entities["oline" ]=(wchar_t )0x203E;
entities["frasl" ]=(wchar_t )0x2044;
entities["euro" ]=(wchar_t )0x20AC;
entities["image" ]=(wchar_t )0x2111;
entities["weierp" ]=(wchar_t )0x2118;
entities["real" ]=(wchar_t )0x211C;
entities["trade" ]=(wchar_t )0x2122;
entities["alefsym" ]=(wchar_t )0x2135;
entities["larr" ]=(wchar_t )0x2190;
entities["uarr" ]=(wchar_t )0x2191;
entities["rarr" ]=(wchar_t )0x2192;
entities["darr" ]=(wchar_t )0x2193;
entities["harr" ]=(wchar_t )0x2194;
entities["crarr" ]=(wchar_t )0x21B5;
entities["lArr" ]=(wchar_t )0x21D0;
Last edited on Mar 5, 2010 at 10:23pm UTC
Mar 5, 2010 at 10:32pm UTC
That's one lengthy table.
Mar 5, 2010 at 10:38pm UTC
Last edited on Mar 5, 2010 at 10:40pm UTC
Mar 5, 2010 at 11:41pm UTC
That loop is horrible. How does it even work? Surely you can't do an assignment like that?
Mar 6, 2010 at 5:27pm UTC
You mean of putting the condition outside the for? None, really, but what's the difference? At least it's slightly easier to read than
for (unsigned long a=0;SJIS2Unicode_compact[a] || SJIS2Unicode_compact[a+1];)
Mar 6, 2010 at 6:45pm UTC
"Shift JIS to Unicode" and "Unicode to Shift JIS". They're conversion tables.
Mar 6, 2010 at 8:22pm UTC
Ohh... I get it. That makes sense.