| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| EntityArrays |
|
| 1.0909090909090908;1.091 |
| 1 | /* | |
| 2 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
| 3 | * contributor license agreements. See the NOTICE file distributed with | |
| 4 | * this work for additional information regarding copyright ownership. | |
| 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
| 6 | * (the "License"); you may not use this file except in compliance with | |
| 7 | * the License. You may obtain a copy of the License at | |
| 8 | * | |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 | |
| 10 | * | |
| 11 | * Unless required by applicable law or agreed to in writing, software | |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, | |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 14 | * See the License for the specific language governing permissions and | |
| 15 | * limitations under the License. | |
| 16 | */ | |
| 17 | package org.apache.commons.lang3.text.translate; | |
| 18 | ||
| 19 | /** | |
| 20 | * Class holding various entity data for HTML and XML - generally for use with | |
| 21 | * the LookupTranslator. | |
| 22 | * All arrays are of length [*][2]. | |
| 23 | * | |
| 24 | * @since 3.0 | |
| 25 | * @version $Id: EntityArrays.java 1436770 2013-01-22 07:09:45Z ggregory $ | |
| 26 | */ | |
| 27 | 1 | public class EntityArrays { |
| 28 | ||
| 29 | /** | |
| 30 | * Mapping to escape <a href="https://secure.wikimedia.org/wikipedia/en/wiki/ISO/IEC_8859-1">ISO-8859-1</a> | |
| 31 | * characters to their named HTML 3.x equivalents. | |
| 32 | * @return the mapping table | |
| 33 | */ | |
| 34 | 3 | public static String[][] ISO8859_1_ESCAPE() { return ISO8859_1_ESCAPE.clone(); } |
| 35 | 1 | private static final String[][] ISO8859_1_ESCAPE = { |
| 36 | {"\u00A0", " "}, // non-breaking space | |
| 37 | {"\u00A1", "¡"}, // inverted exclamation mark | |
| 38 | {"\u00A2", "¢"}, // cent sign | |
| 39 | {"\u00A3", "£"}, // pound sign | |
| 40 | {"\u00A4", "¤"}, // currency sign | |
| 41 | {"\u00A5", "¥"}, // yen sign = yuan sign | |
| 42 | {"\u00A6", "¦"}, // broken bar = broken vertical bar | |
| 43 | {"\u00A7", "§"}, // section sign | |
| 44 | {"\u00A8", "¨"}, // diaeresis = spacing diaeresis | |
| 45 | {"\u00A9", "©"}, // © - copyright sign | |
| 46 | {"\u00AA", "ª"}, // feminine ordinal indicator | |
| 47 | {"\u00AB", "«"}, // left-pointing double angle quotation mark = left pointing guillemet | |
| 48 | {"\u00AC", "¬"}, // not sign | |
| 49 | {"\u00AD", "­"}, // soft hyphen = discretionary hyphen | |
| 50 | {"\u00AE", "®"}, // ® - registered trademark sign | |
| 51 | {"\u00AF", "¯"}, // macron = spacing macron = overline = APL overbar | |
| 52 | {"\u00B0", "°"}, // degree sign | |
| 53 | {"\u00B1", "±"}, // plus-minus sign = plus-or-minus sign | |
| 54 | {"\u00B2", "²"}, // superscript two = superscript digit two = squared | |
| 55 | {"\u00B3", "³"}, // superscript three = superscript digit three = cubed | |
| 56 | {"\u00B4", "´"}, // acute accent = spacing acute | |
| 57 | {"\u00B5", "µ"}, // micro sign | |
| 58 | {"\u00B6", "¶"}, // pilcrow sign = paragraph sign | |
| 59 | {"\u00B7", "·"}, // middle dot = Georgian comma = Greek middle dot | |
| 60 | {"\u00B8", "¸"}, // cedilla = spacing cedilla | |
| 61 | {"\u00B9", "¹"}, // superscript one = superscript digit one | |
| 62 | {"\u00BA", "º"}, // masculine ordinal indicator | |
| 63 | {"\u00BB", "»"}, // right-pointing double angle quotation mark = right pointing guillemet | |
| 64 | {"\u00BC", "¼"}, // vulgar fraction one quarter = fraction one quarter | |
| 65 | {"\u00BD", "½"}, // vulgar fraction one half = fraction one half | |
| 66 | {"\u00BE", "¾"}, // vulgar fraction three quarters = fraction three quarters | |
| 67 | {"\u00BF", "¿"}, // inverted question mark = turned question mark | |
| 68 | {"\u00C0", "À"}, // À - uppercase A, grave accent | |
| 69 | {"\u00C1", "Á"}, // Á - uppercase A, acute accent | |
| 70 | {"\u00C2", "Â"}, // Â - uppercase A, circumflex accent | |
| 71 | {"\u00C3", "Ã"}, // Ã - uppercase A, tilde | |
| 72 | {"\u00C4", "Ä"}, // Ä - uppercase A, umlaut | |
| 73 | {"\u00C5", "Å"}, // Å - uppercase A, ring | |
| 74 | {"\u00C6", "Æ"}, // Æ - uppercase AE | |
| 75 | {"\u00C7", "Ç"}, // Ç - uppercase C, cedilla | |
| 76 | {"\u00C8", "È"}, // È - uppercase E, grave accent | |
| 77 | {"\u00C9", "É"}, // É - uppercase E, acute accent | |
| 78 | {"\u00CA", "Ê"}, // Ê - uppercase E, circumflex accent | |
| 79 | {"\u00CB", "Ë"}, // Ë - uppercase E, umlaut | |
| 80 | {"\u00CC", "Ì"}, // Ì - uppercase I, grave accent | |
| 81 | {"\u00CD", "Í"}, // Í - uppercase I, acute accent | |
| 82 | {"\u00CE", "Î"}, // Î - uppercase I, circumflex accent | |
| 83 | {"\u00CF", "Ï"}, // Ï - uppercase I, umlaut | |
| 84 | {"\u00D0", "Ð"}, // Ð - uppercase Eth, Icelandic | |
| 85 | {"\u00D1", "Ñ"}, // Ñ - uppercase N, tilde | |
| 86 | {"\u00D2", "Ò"}, // Ò - uppercase O, grave accent | |
| 87 | {"\u00D3", "Ó"}, // Ó - uppercase O, acute accent | |
| 88 | {"\u00D4", "Ô"}, // Ô - uppercase O, circumflex accent | |
| 89 | {"\u00D5", "Õ"}, // Õ - uppercase O, tilde | |
| 90 | {"\u00D6", "Ö"}, // Ö - uppercase O, umlaut | |
| 91 | {"\u00D7", "×"}, // multiplication sign | |
| 92 | {"\u00D8", "Ø"}, // Ø - uppercase O, slash | |
| 93 | {"\u00D9", "Ù"}, // Ù - uppercase U, grave accent | |
| 94 | {"\u00DA", "Ú"}, // Ú - uppercase U, acute accent | |
| 95 | {"\u00DB", "Û"}, // Û - uppercase U, circumflex accent | |
| 96 | {"\u00DC", "Ü"}, // Ü - uppercase U, umlaut | |
| 97 | {"\u00DD", "Ý"}, // Ý - uppercase Y, acute accent | |
| 98 | {"\u00DE", "Þ"}, // Þ - uppercase THORN, Icelandic | |
| 99 | {"\u00DF", "ß"}, // ß - lowercase sharps, German | |
| 100 | {"\u00E0", "à"}, // à - lowercase a, grave accent | |
| 101 | {"\u00E1", "á"}, // á - lowercase a, acute accent | |
| 102 | {"\u00E2", "â"}, // â - lowercase a, circumflex accent | |
| 103 | {"\u00E3", "ã"}, // ã - lowercase a, tilde | |
| 104 | {"\u00E4", "ä"}, // ä - lowercase a, umlaut | |
| 105 | {"\u00E5", "å"}, // å - lowercase a, ring | |
| 106 | {"\u00E6", "æ"}, // æ - lowercase ae | |
| 107 | {"\u00E7", "ç"}, // ç - lowercase c, cedilla | |
| 108 | {"\u00E8", "è"}, // è - lowercase e, grave accent | |
| 109 | {"\u00E9", "é"}, // é - lowercase e, acute accent | |
| 110 | {"\u00EA", "ê"}, // ê - lowercase e, circumflex accent | |
| 111 | {"\u00EB", "ë"}, // ë - lowercase e, umlaut | |
| 112 | {"\u00EC", "ì"}, // ì - lowercase i, grave accent | |
| 113 | {"\u00ED", "í"}, // í - lowercase i, acute accent | |
| 114 | {"\u00EE", "î"}, // î - lowercase i, circumflex accent | |
| 115 | {"\u00EF", "ï"}, // ï - lowercase i, umlaut | |
| 116 | {"\u00F0", "ð"}, // ð - lowercase eth, Icelandic | |
| 117 | {"\u00F1", "ñ"}, // ñ - lowercase n, tilde | |
| 118 | {"\u00F2", "ò"}, // ò - lowercase o, grave accent | |
| 119 | {"\u00F3", "ó"}, // ó - lowercase o, acute accent | |
| 120 | {"\u00F4", "ô"}, // ô - lowercase o, circumflex accent | |
| 121 | {"\u00F5", "õ"}, // õ - lowercase o, tilde | |
| 122 | {"\u00F6", "ö"}, // ö - lowercase o, umlaut | |
| 123 | {"\u00F7", "÷"}, // division sign | |
| 124 | {"\u00F8", "ø"}, // ø - lowercase o, slash | |
| 125 | {"\u00F9", "ù"}, // ù - lowercase u, grave accent | |
| 126 | {"\u00FA", "ú"}, // ú - lowercase u, acute accent | |
| 127 | {"\u00FB", "û"}, // û - lowercase u, circumflex accent | |
| 128 | {"\u00FC", "ü"}, // ü - lowercase u, umlaut | |
| 129 | {"\u00FD", "ý"}, // ý - lowercase y, acute accent | |
| 130 | {"\u00FE", "þ"}, // þ - lowercase thorn, Icelandic | |
| 131 | {"\u00FF", "ÿ"}, // ÿ - lowercase y, umlaut | |
| 132 | }; | |
| 133 | ||
| 134 | /** | |
| 135 | * Reverse of {@link #ISO8859_1_ESCAPE()} for unescaping purposes. | |
| 136 | * @return the mapping table | |
| 137 | */ | |
| 138 | 2 | public static String[][] ISO8859_1_UNESCAPE() { return ISO8859_1_UNESCAPE.clone(); } |
| 139 | 1 | private static final String[][] ISO8859_1_UNESCAPE = invert(ISO8859_1_ESCAPE); |
| 140 | ||
| 141 | /** | |
| 142 | * Mapping to escape additional <a href="http://www.w3.org/TR/REC-html40/sgml/entities.html">character entity | |
| 143 | * references</a>. Note that this must be used with {@link #ISO8859_1_ESCAPE()} to get the full list of | |
| 144 | * HTML 4.0 character entities. | |
| 145 | * @return the mapping table | |
| 146 | */ | |
| 147 | 2 | public static String[][] HTML40_EXTENDED_ESCAPE() { return HTML40_EXTENDED_ESCAPE.clone(); } |
| 148 | 1 | private static final String[][] HTML40_EXTENDED_ESCAPE = { |
| 149 | // <!-- Latin Extended-B --> | |
| 150 | {"\u0192", "ƒ"}, // latin small f with hook = function= florin, U+0192 ISOtech --> | |
| 151 | // <!-- Greek --> | |
| 152 | {"\u0391", "Α"}, // greek capital letter alpha, U+0391 --> | |
| 153 | {"\u0392", "Β"}, // greek capital letter beta, U+0392 --> | |
| 154 | {"\u0393", "Γ"}, // greek capital letter gamma,U+0393 ISOgrk3 --> | |
| 155 | {"\u0394", "Δ"}, // greek capital letter delta,U+0394 ISOgrk3 --> | |
| 156 | {"\u0395", "Ε"}, // greek capital letter epsilon, U+0395 --> | |
| 157 | {"\u0396", "Ζ"}, // greek capital letter zeta, U+0396 --> | |
| 158 | {"\u0397", "Η"}, // greek capital letter eta, U+0397 --> | |
| 159 | {"\u0398", "Θ"}, // greek capital letter theta,U+0398 ISOgrk3 --> | |
| 160 | {"\u0399", "Ι"}, // greek capital letter iota, U+0399 --> | |
| 161 | {"\u039A", "Κ"}, // greek capital letter kappa, U+039A --> | |
| 162 | {"\u039B", "Λ"}, // greek capital letter lambda,U+039B ISOgrk3 --> | |
| 163 | {"\u039C", "Μ"}, // greek capital letter mu, U+039C --> | |
| 164 | {"\u039D", "Ν"}, // greek capital letter nu, U+039D --> | |
| 165 | {"\u039E", "Ξ"}, // greek capital letter xi, U+039E ISOgrk3 --> | |
| 166 | {"\u039F", "Ο"}, // greek capital letter omicron, U+039F --> | |
| 167 | {"\u03A0", "Π"}, // greek capital letter pi, U+03A0 ISOgrk3 --> | |
| 168 | {"\u03A1", "Ρ"}, // greek capital letter rho, U+03A1 --> | |
| 169 | // <!-- there is no Sigmaf, and no U+03A2 character either --> | |
| 170 | {"\u03A3", "Σ"}, // greek capital letter sigma,U+03A3 ISOgrk3 --> | |
| 171 | {"\u03A4", "Τ"}, // greek capital letter tau, U+03A4 --> | |
| 172 | {"\u03A5", "Υ"}, // greek capital letter upsilon,U+03A5 ISOgrk3 --> | |
| 173 | {"\u03A6", "Φ"}, // greek capital letter phi,U+03A6 ISOgrk3 --> | |
| 174 | {"\u03A7", "Χ"}, // greek capital letter chi, U+03A7 --> | |
| 175 | {"\u03A8", "Ψ"}, // greek capital letter psi,U+03A8 ISOgrk3 --> | |
| 176 | {"\u03A9", "Ω"}, // greek capital letter omega,U+03A9 ISOgrk3 --> | |
| 177 | {"\u03B1", "α"}, // greek small letter alpha,U+03B1 ISOgrk3 --> | |
| 178 | {"\u03B2", "β"}, // greek small letter beta, U+03B2 ISOgrk3 --> | |
| 179 | {"\u03B3", "γ"}, // greek small letter gamma,U+03B3 ISOgrk3 --> | |
| 180 | {"\u03B4", "δ"}, // greek small letter delta,U+03B4 ISOgrk3 --> | |
| 181 | {"\u03B5", "ε"}, // greek small letter epsilon,U+03B5 ISOgrk3 --> | |
| 182 | {"\u03B6", "ζ"}, // greek small letter zeta, U+03B6 ISOgrk3 --> | |
| 183 | {"\u03B7", "η"}, // greek small letter eta, U+03B7 ISOgrk3 --> | |
| 184 | {"\u03B8", "θ"}, // greek small letter theta,U+03B8 ISOgrk3 --> | |
| 185 | {"\u03B9", "ι"}, // greek small letter iota, U+03B9 ISOgrk3 --> | |
| 186 | {"\u03BA", "κ"}, // greek small letter kappa,U+03BA ISOgrk3 --> | |
| 187 | {"\u03BB", "λ"}, // greek small letter lambda,U+03BB ISOgrk3 --> | |
| 188 | {"\u03BC", "μ"}, // greek small letter mu, U+03BC ISOgrk3 --> | |
| 189 | {"\u03BD", "ν"}, // greek small letter nu, U+03BD ISOgrk3 --> | |
| 190 | {"\u03BE", "ξ"}, // greek small letter xi, U+03BE ISOgrk3 --> | |
| 191 | {"\u03BF", "ο"}, // greek small letter omicron, U+03BF NEW --> | |
| 192 | {"\u03C0", "π"}, // greek small letter pi, U+03C0 ISOgrk3 --> | |
| 193 | {"\u03C1", "ρ"}, // greek small letter rho, U+03C1 ISOgrk3 --> | |
| 194 | {"\u03C2", "ς"}, // greek small letter final sigma,U+03C2 ISOgrk3 --> | |
| 195 | {"\u03C3", "σ"}, // greek small letter sigma,U+03C3 ISOgrk3 --> | |
| 196 | {"\u03C4", "τ"}, // greek small letter tau, U+03C4 ISOgrk3 --> | |
| 197 | {"\u03C5", "υ"}, // greek small letter upsilon,U+03C5 ISOgrk3 --> | |
| 198 | {"\u03C6", "φ"}, // greek small letter phi, U+03C6 ISOgrk3 --> | |
| 199 | {"\u03C7", "χ"}, // greek small letter chi, U+03C7 ISOgrk3 --> | |
| 200 | {"\u03C8", "ψ"}, // greek small letter psi, U+03C8 ISOgrk3 --> | |
| 201 | {"\u03C9", "ω"}, // greek small letter omega,U+03C9 ISOgrk3 --> | |
| 202 | {"\u03D1", "ϑ"}, // greek small letter theta symbol,U+03D1 NEW --> | |
| 203 | {"\u03D2", "ϒ"}, // greek upsilon with hook symbol,U+03D2 NEW --> | |
| 204 | {"\u03D6", "ϖ"}, // greek pi symbol, U+03D6 ISOgrk3 --> | |
| 205 | // <!-- General Punctuation --> | |
| 206 | {"\u2022", "•"}, // bullet = black small circle,U+2022 ISOpub --> | |
| 207 | // <!-- bullet is NOT the same as bullet operator, U+2219 --> | |
| 208 | {"\u2026", "…"}, // horizontal ellipsis = three dot leader,U+2026 ISOpub --> | |
| 209 | {"\u2032", "′"}, // prime = minutes = feet, U+2032 ISOtech --> | |
| 210 | {"\u2033", "″"}, // double prime = seconds = inches,U+2033 ISOtech --> | |
| 211 | {"\u203E", "‾"}, // overline = spacing overscore,U+203E NEW --> | |
| 212 | {"\u2044", "⁄"}, // fraction slash, U+2044 NEW --> | |
| 213 | // <!-- Letterlike Symbols --> | |
| 214 | {"\u2118", "℘"}, // script capital P = power set= Weierstrass p, U+2118 ISOamso --> | |
| 215 | {"\u2111", "ℑ"}, // blackletter capital I = imaginary part,U+2111 ISOamso --> | |
| 216 | {"\u211C", "ℜ"}, // blackletter capital R = real part symbol,U+211C ISOamso --> | |
| 217 | {"\u2122", "™"}, // trade mark sign, U+2122 ISOnum --> | |
| 218 | {"\u2135", "ℵ"}, // alef symbol = first transfinite cardinal,U+2135 NEW --> | |
| 219 | // <!-- alef symbol is NOT the same as hebrew letter alef,U+05D0 although the | |
| 220 | // same glyph could be used to depict both characters --> | |
| 221 | // <!-- Arrows --> | |
| 222 | {"\u2190", "←"}, // leftwards arrow, U+2190 ISOnum --> | |
| 223 | {"\u2191", "↑"}, // upwards arrow, U+2191 ISOnum--> | |
| 224 | {"\u2192", "→"}, // rightwards arrow, U+2192 ISOnum --> | |
| 225 | {"\u2193", "↓"}, // downwards arrow, U+2193 ISOnum --> | |
| 226 | {"\u2194", "↔"}, // left right arrow, U+2194 ISOamsa --> | |
| 227 | {"\u21B5", "↵"}, // downwards arrow with corner leftwards= carriage return, U+21B5 NEW --> | |
| 228 | {"\u21D0", "⇐"}, // leftwards double arrow, U+21D0 ISOtech --> | |
| 229 | // <!-- ISO 10646 does not say that lArr is the same as the 'is implied by' | |
| 230 | // arrow but also does not have any other character for that function. | |
| 231 | // So ? lArr canbe used for 'is implied by' as ISOtech suggests --> | |
| 232 | {"\u21D1", "⇑"}, // upwards double arrow, U+21D1 ISOamsa --> | |
| 233 | {"\u21D2", "⇒"}, // rightwards double arrow,U+21D2 ISOtech --> | |
| 234 | // <!-- ISO 10646 does not say this is the 'implies' character but does not | |
| 235 | // have another character with this function so ?rArr can be used for | |
| 236 | // 'implies' as ISOtech suggests --> | |
| 237 | {"\u21D3", "⇓"}, // downwards double arrow, U+21D3 ISOamsa --> | |
| 238 | {"\u21D4", "⇔"}, // left right double arrow,U+21D4 ISOamsa --> | |
| 239 | // <!-- Mathematical Operators --> | |
| 240 | {"\u2200", "∀"}, // for all, U+2200 ISOtech --> | |
| 241 | {"\u2202", "∂"}, // partial differential, U+2202 ISOtech --> | |
| 242 | {"\u2203", "∃"}, // there exists, U+2203 ISOtech --> | |
| 243 | {"\u2205", "∅"}, // empty set = null set = diameter,U+2205 ISOamso --> | |
| 244 | {"\u2207", "∇"}, // nabla = backward difference,U+2207 ISOtech --> | |
| 245 | {"\u2208", "∈"}, // element of, U+2208 ISOtech --> | |
| 246 | {"\u2209", "∉"}, // not an element of, U+2209 ISOtech --> | |
| 247 | {"\u220B", "∋"}, // contains as member, U+220B ISOtech --> | |
| 248 | // <!-- should there be a more memorable name than 'ni'? --> | |
| 249 | {"\u220F", "∏"}, // n-ary product = product sign,U+220F ISOamsb --> | |
| 250 | // <!-- prod is NOT the same character as U+03A0 'greek capital letter pi' | |
| 251 | // though the same glyph might be used for both --> | |
| 252 | {"\u2211", "∑"}, // n-ary summation, U+2211 ISOamsb --> | |
| 253 | // <!-- sum is NOT the same character as U+03A3 'greek capital letter sigma' | |
| 254 | // though the same glyph might be used for both --> | |
| 255 | {"\u2212", "−"}, // minus sign, U+2212 ISOtech --> | |
| 256 | {"\u2217", "∗"}, // asterisk operator, U+2217 ISOtech --> | |
| 257 | {"\u221A", "√"}, // square root = radical sign,U+221A ISOtech --> | |
| 258 | {"\u221D", "∝"}, // proportional to, U+221D ISOtech --> | |
| 259 | {"\u221E", "∞"}, // infinity, U+221E ISOtech --> | |
| 260 | {"\u2220", "∠"}, // angle, U+2220 ISOamso --> | |
| 261 | {"\u2227", "∧"}, // logical and = wedge, U+2227 ISOtech --> | |
| 262 | {"\u2228", "∨"}, // logical or = vee, U+2228 ISOtech --> | |
| 263 | {"\u2229", "∩"}, // intersection = cap, U+2229 ISOtech --> | |
| 264 | {"\u222A", "∪"}, // union = cup, U+222A ISOtech --> | |
| 265 | {"\u222B", "∫"}, // integral, U+222B ISOtech --> | |
| 266 | {"\u2234", "∴"}, // therefore, U+2234 ISOtech --> | |
| 267 | {"\u223C", "∼"}, // tilde operator = varies with = similar to,U+223C ISOtech --> | |
| 268 | // <!-- tilde operator is NOT the same character as the tilde, U+007E,although | |
| 269 | // the same glyph might be used to represent both --> | |
| 270 | {"\u2245", "≅"}, // approximately equal to, U+2245 ISOtech --> | |
| 271 | {"\u2248", "≈"}, // almost equal to = asymptotic to,U+2248 ISOamsr --> | |
| 272 | {"\u2260", "≠"}, // not equal to, U+2260 ISOtech --> | |
| 273 | {"\u2261", "≡"}, // identical to, U+2261 ISOtech --> | |
| 274 | {"\u2264", "≤"}, // less-than or equal to, U+2264 ISOtech --> | |
| 275 | {"\u2265", "≥"}, // greater-than or equal to,U+2265 ISOtech --> | |
| 276 | {"\u2282", "⊂"}, // subset of, U+2282 ISOtech --> | |
| 277 | {"\u2283", "⊃"}, // superset of, U+2283 ISOtech --> | |
| 278 | // <!-- note that nsup, 'not a superset of, U+2283' is not covered by the | |
| 279 | // Symbol font encoding and is not included. Should it be, for symmetry? | |
| 280 | // It is in ISOamsn --> <!ENTITY nsub", "8836"}, | |
| 281 | // not a subset of, U+2284 ISOamsn --> | |
| 282 | {"\u2286", "⊆"}, // subset of or equal to, U+2286 ISOtech --> | |
| 283 | {"\u2287", "⊇"}, // superset of or equal to,U+2287 ISOtech --> | |
| 284 | {"\u2295", "⊕"}, // circled plus = direct sum,U+2295 ISOamsb --> | |
| 285 | {"\u2297", "⊗"}, // circled times = vector product,U+2297 ISOamsb --> | |
| 286 | {"\u22A5", "⊥"}, // up tack = orthogonal to = perpendicular,U+22A5 ISOtech --> | |
| 287 | {"\u22C5", "⋅"}, // dot operator, U+22C5 ISOamsb --> | |
| 288 | // <!-- dot operator is NOT the same character as U+00B7 middle dot --> | |
| 289 | // <!-- Miscellaneous Technical --> | |
| 290 | {"\u2308", "⌈"}, // left ceiling = apl upstile,U+2308 ISOamsc --> | |
| 291 | {"\u2309", "⌉"}, // right ceiling, U+2309 ISOamsc --> | |
| 292 | {"\u230A", "⌊"}, // left floor = apl downstile,U+230A ISOamsc --> | |
| 293 | {"\u230B", "⌋"}, // right floor, U+230B ISOamsc --> | |
| 294 | {"\u2329", "⟨"}, // left-pointing angle bracket = bra,U+2329 ISOtech --> | |
| 295 | // <!-- lang is NOT the same character as U+003C 'less than' or U+2039 'single left-pointing angle quotation | |
| 296 | // mark' --> | |
| 297 | {"\u232A", "⟩"}, // right-pointing angle bracket = ket,U+232A ISOtech --> | |
| 298 | // <!-- rang is NOT the same character as U+003E 'greater than' or U+203A | |
| 299 | // 'single right-pointing angle quotation mark' --> | |
| 300 | // <!-- Geometric Shapes --> | |
| 301 | {"\u25CA", "◊"}, // lozenge, U+25CA ISOpub --> | |
| 302 | // <!-- Miscellaneous Symbols --> | |
| 303 | {"\u2660", "♠"}, // black spade suit, U+2660 ISOpub --> | |
| 304 | // <!-- black here seems to mean filled as opposed to hollow --> | |
| 305 | {"\u2663", "♣"}, // black club suit = shamrock,U+2663 ISOpub --> | |
| 306 | {"\u2665", "♥"}, // black heart suit = valentine,U+2665 ISOpub --> | |
| 307 | {"\u2666", "♦"}, // black diamond suit, U+2666 ISOpub --> | |
| 308 | ||
| 309 | // <!-- Latin Extended-A --> | |
| 310 | {"\u0152", "Œ"}, // -- latin capital ligature OE,U+0152 ISOlat2 --> | |
| 311 | {"\u0153", "œ"}, // -- latin small ligature oe, U+0153 ISOlat2 --> | |
| 312 | // <!-- ligature is a misnomer, this is a separate character in some languages --> | |
| 313 | {"\u0160", "Š"}, // -- latin capital letter S with caron,U+0160 ISOlat2 --> | |
| 314 | {"\u0161", "š"}, // -- latin small letter s with caron,U+0161 ISOlat2 --> | |
| 315 | {"\u0178", "Ÿ"}, // -- latin capital letter Y with diaeresis,U+0178 ISOlat2 --> | |
| 316 | // <!-- Spacing Modifier Letters --> | |
| 317 | {"\u02C6", "ˆ"}, // -- modifier letter circumflex accent,U+02C6 ISOpub --> | |
| 318 | {"\u02DC", "˜"}, // small tilde, U+02DC ISOdia --> | |
| 319 | // <!-- General Punctuation --> | |
| 320 | {"\u2002", " "}, // en space, U+2002 ISOpub --> | |
| 321 | {"\u2003", " "}, // em space, U+2003 ISOpub --> | |
| 322 | {"\u2009", " "}, // thin space, U+2009 ISOpub --> | |
| 323 | {"\u200C", "‌"}, // zero width non-joiner,U+200C NEW RFC 2070 --> | |
| 324 | {"\u200D", "‍"}, // zero width joiner, U+200D NEW RFC 2070 --> | |
| 325 | {"\u200E", "‎"}, // left-to-right mark, U+200E NEW RFC 2070 --> | |
| 326 | {"\u200F", "‏"}, // right-to-left mark, U+200F NEW RFC 2070 --> | |
| 327 | {"\u2013", "–"}, // en dash, U+2013 ISOpub --> | |
| 328 | {"\u2014", "—"}, // em dash, U+2014 ISOpub --> | |
| 329 | {"\u2018", "‘"}, // left single quotation mark,U+2018 ISOnum --> | |
| 330 | {"\u2019", "’"}, // right single quotation mark,U+2019 ISOnum --> | |
| 331 | {"\u201A", "‚"}, // single low-9 quotation mark, U+201A NEW --> | |
| 332 | {"\u201C", "“"}, // left double quotation mark,U+201C ISOnum --> | |
| 333 | {"\u201D", "”"}, // right double quotation mark,U+201D ISOnum --> | |
| 334 | {"\u201E", "„"}, // double low-9 quotation mark, U+201E NEW --> | |
| 335 | {"\u2020", "†"}, // dagger, U+2020 ISOpub --> | |
| 336 | {"\u2021", "‡"}, // double dagger, U+2021 ISOpub --> | |
| 337 | {"\u2030", "‰"}, // per mille sign, U+2030 ISOtech --> | |
| 338 | {"\u2039", "‹"}, // single left-pointing angle quotation mark,U+2039 ISO proposed --> | |
| 339 | // <!-- lsaquo is proposed but not yet ISO standardized --> | |
| 340 | {"\u203A", "›"}, // single right-pointing angle quotation mark,U+203A ISO proposed --> | |
| 341 | // <!-- rsaquo is proposed but not yet ISO standardized --> | |
| 342 | {"\u20AC", "€"}, // -- euro sign, U+20AC NEW --> | |
| 343 | }; | |
| 344 | ||
| 345 | /** | |
| 346 | * Reverse of {@link #HTML40_EXTENDED_ESCAPE()} for unescaping purposes. | |
| 347 | * @return the mapping table | |
| 348 | */ | |
| 349 | 1 | public static String[][] HTML40_EXTENDED_UNESCAPE() { return HTML40_EXTENDED_UNESCAPE.clone(); } |
| 350 | 1 | private static final String[][] HTML40_EXTENDED_UNESCAPE = invert(HTML40_EXTENDED_ESCAPE); |
| 351 | ||
| 352 | /** | |
| 353 | * Mapping to escape the basic XML and HTML character entities. | |
| 354 | * | |
| 355 | * Namely: {@code " & < >} | |
| 356 | * @return the mapping table | |
| 357 | */ | |
| 358 | 3 | public static String[][] BASIC_ESCAPE() { return BASIC_ESCAPE.clone(); } |
| 359 | 1 | private static final String[][] BASIC_ESCAPE = { |
| 360 | {"\"", """}, // " - double-quote | |
| 361 | {"&", "&"}, // & - ampersand | |
| 362 | {"<", "<"}, // < - less-than | |
| 363 | {">", ">"}, // > - greater-than | |
| 364 | }; | |
| 365 | ||
| 366 | /** | |
| 367 | * Reverse of {@link #BASIC_ESCAPE()} for unescaping purposes. | |
| 368 | * @return the mapping table | |
| 369 | */ | |
| 370 | 3 | public static String[][] BASIC_UNESCAPE() { return BASIC_UNESCAPE.clone(); } |
| 371 | 1 | private static final String[][] BASIC_UNESCAPE = invert(BASIC_ESCAPE); |
| 372 | ||
| 373 | /** | |
| 374 | * Mapping to escape the apostrophe character to its XML character entity. | |
| 375 | * @return the mapping table | |
| 376 | */ | |
| 377 | 1 | public static String[][] APOS_ESCAPE() { return APOS_ESCAPE.clone(); } |
| 378 | 1 | private static final String[][] APOS_ESCAPE = { |
| 379 | {"'", "'"}, // XML apostrophe | |
| 380 | }; | |
| 381 | ||
| 382 | /** | |
| 383 | * Reverse of {@link #APOS_ESCAPE()} for unescaping purposes. | |
| 384 | * @return the mapping table | |
| 385 | */ | |
| 386 | 1 | public static String[][] APOS_UNESCAPE() { return APOS_UNESCAPE.clone(); } |
| 387 | 1 | private static final String[][] APOS_UNESCAPE = invert(APOS_ESCAPE); |
| 388 | ||
| 389 | /** | |
| 390 | * Mapping to escape the Java control characters. | |
| 391 | * | |
| 392 | * Namely: {@code \b \n \t \f \r} | |
| 393 | * @return the mapping table | |
| 394 | */ | |
| 395 | 2 | public static String[][] JAVA_CTRL_CHARS_ESCAPE() { return JAVA_CTRL_CHARS_ESCAPE.clone(); } |
| 396 | 1 | private static final String[][] JAVA_CTRL_CHARS_ESCAPE = { |
| 397 | {"\b", "\\b"}, | |
| 398 | {"\n", "\\n"}, | |
| 399 | {"\t", "\\t"}, | |
| 400 | {"\f", "\\f"}, | |
| 401 | {"\r", "\\r"} | |
| 402 | }; | |
| 403 | ||
| 404 | /** | |
| 405 | * Reverse of {@link #JAVA_CTRL_CHARS_ESCAPE()} for unescaping purposes. | |
| 406 | * @return the mapping table | |
| 407 | */ | |
| 408 | 1 | public static String[][] JAVA_CTRL_CHARS_UNESCAPE() { return JAVA_CTRL_CHARS_UNESCAPE.clone(); } |
| 409 | 1 | private static final String[][] JAVA_CTRL_CHARS_UNESCAPE = invert(JAVA_CTRL_CHARS_ESCAPE); |
| 410 | ||
| 411 | /** | |
| 412 | * Used to invert an escape array into an unescape array | |
| 413 | * @param array String[][] to be inverted | |
| 414 | * @return String[][] inverted array | |
| 415 | */ | |
| 416 | public static String[][] invert(final String[][] array) { | |
| 417 | 5 | final String[][] newarray = new String[array.length][2]; |
| 418 | 262 | for(int i = 0; i<array.length; i++) { |
| 419 | 257 | newarray[i][0] = array[i][1]; |
| 420 | 257 | newarray[i][1] = array[i][0]; |
| 421 | } | |
| 422 | 5 | return newarray; |
| 423 | } | |
| 424 | ||
| 425 | } |