1 /* Copyright 2002-2004 Elliotte Rusty Harold 2 3 This library is free software; you can redistribute it and/or modify 4 it under the terms of version 2.1 of the GNU Lesser General Public 5 License as published by the Free Software Foundation. 6 7 This library is distributed in the hope that it will be useful, 8 but WITHOUT ANY WARRANTY; without even the implied warranty of 9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 GNU Lesser General Public License for more details. 11 12 You should have received a copy of the GNU Lesser General Public 13 License along with this library; if not, write to the 14 Free Software Foundation, Inc., 59 Temple Place, Suite 330, 15 Boston, MA 02111-1307 USA 16 17 You can contact Elliotte Rusty Harold by sending e-mail to 18 elharo@ibiblio.org. Please include the word "XOM" in the 19 subject line. The XOM home page is located at http://www.xom.nu/ 20 */ 21 22 package nu.xom; 23 24 import java.io.Writer; 25 26 /** 27 * 28 * <p> 29 * ISO 8859-16, Romanian. Not yet supported by Sun's JDK as of 1.5 30 * alpha. IBM's 1.4.1 JDK does support it. 31 * </p> 32 * 33 * @author Elliotte Rusty Harold 34 * @version 1.0 35 * 36 */ 37 class Latin10Writer extends TextWriter { 38 39 Latin10Writer(Writer out, String encoding)40 Latin10Writer(Writer out, String encoding) { 41 super(out, encoding); 42 } 43 44 45 /** 46 * @see nu.xom.TextWriter#needsEscaping(char) 47 */ needsEscaping(char c)48 boolean needsEscaping(char c) { 49 if (c <= 0xA0) return false; 50 switch (c) { 51 case 0x00A7: return false; // SECTION SIGN 52 case 0x00A8: return true; // place holder to allow optimization of switch statement 53 case 0x00A9: return false; // COPYRIGHT SIGN 54 case 0x00AA: return true; // place holder to allow optimization of switch statement 55 case 0x00AB: return false; // LEFT-POINTING DOUBLE ANGLE QUOTATION MARK 56 case 0x00AC: return true; // place holder to allow optimization of switch statement 57 case 0x00AD: return false; // SOFT HYPHEN 58 case 0x00AE: return true; // place holder to allow optimization of switch statement 59 case 0x00AF: return true; // place holder to allow optimization of switch statement 60 case 0x00B0: return false; // DEGREE SIGN 61 case 0x00B1: return false; // PLUS-MINUS SIGN 62 case 0x00B2: return true; // place holder to allow optimization of switch statement 63 case 0x00B3: return true; // place holder to allow optimization of switch statement 64 case 0x00B4: return true; // place holder to allow optimization of switch statement 65 case 0x00B5: return true; // place holder to allow optimization of switch statement 66 case 0x00B6: return false; // PILCROW SIGN 67 case 0x00B7: return false; // MIDDLE DOT 68 case 0x00B8: return true; // place holder to allow optimization of switch statement 69 case 0x00B9: return true; // place holder to allow optimization of switch statement 70 case 0x00BA: return true; // place holder to allow optimization of switch statement 71 case 0x00BB: return false; // RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK 72 case 0x00BC: return true; // place holder to allow optimization of switch statement 73 case 0x00BD: return true; // place holder to allow optimization of switch statement 74 case 0x00BE: return true; // place holder to allow optimization of switch statement 75 case 0x00BF: return true; // place holder to allow optimization of switch statement 76 case 0x00C0: return false; // LATIN CAPITAL LETTER A WITH GRAVE 77 case 0x00C1: return false; // LATIN CAPITAL LETTER A WITH ACUTE 78 case 0x00C2: return false; // LATIN CAPITAL LETTER A WITH CIRCUMFLEX 79 case 0x00C3: return true; // place holder to allow optimization of switch statement 80 case 0x00C4: return false; // LATIN CAPITAL LETTER A WITH DIAERESIS 81 case 0x00C5: return true; // place holder to allow optimization of switch statement 82 case 0x00C6: return false; // LATIN CAPITAL LETTER AE 83 case 0x00C7: return false; // LATIN CAPITAL LETTER C WITH CEDILLA 84 case 0x00C8: return false; // LATIN CAPITAL LETTER E WITH GRAVE 85 case 0x00C9: return false; // LATIN CAPITAL LETTER E WITH ACUTE 86 case 0x00CA: return false; // LATIN CAPITAL LETTER E WITH CIRCUMFLEX 87 case 0x00CB: return false; // LATIN CAPITAL LETTER E WITH DIAERESIS 88 case 0x00CC: return false; // LATIN CAPITAL LETTER I WITH GRAVE 89 case 0x00CD: return false; // LATIN CAPITAL LETTER I WITH ACUTE 90 case 0x00CE: return false; // LATIN CAPITAL LETTER I WITH CIRCUMFLEX 91 case 0x00CF: return false; // LATIN CAPITAL LETTER I WITH DIAERESIS 92 case 0x00D0: return true; // place holder to allow optimization of switch statement 93 case 0x00D1: return true; // place holder to allow optimization of switch statement 94 case 0x00D2: return false; // LATIN CAPITAL LETTER O WITH GRAVE 95 case 0x00D3: return false; // LATIN CAPITAL LETTER O WITH ACUTE 96 case 0x00D4: return false; // LATIN CAPITAL LETTER O WITH CIRCUMFLEX 97 case 0x00D5: return true; // place holder to allow optimization of switch statement 98 case 0x00D6: return false; // LATIN CAPITAL LETTER O WITH DIAERESIS 99 case 0x00D7: return true; // place holder to allow optimization of switch statement 100 case 0x00D8: return true; // place holder to allow optimization of switch statement 101 case 0x00D9: return false; // LATIN CAPITAL LETTER U WITH GRAVE 102 case 0x00DA: return false; // LATIN CAPITAL LETTER U WITH ACUTE 103 case 0x00DB: return false; // LATIN CAPITAL LETTER U WITH CIRCUMFLEX 104 case 0x00DC: return false; // LATIN CAPITAL LETTER U WITH DIAERESIS 105 case 0x00DD: return true; // place holder to allow optimization of switch statement 106 case 0x00DE: return true; // place holder to allow optimization of switch statement 107 case 0x00DF: return false; // LATIN SMALL LETTER SHARP S 108 case 0x00E0: return false; // LATIN SMALL LETTER A WITH GRAVE 109 case 0x00E1: return false; // LATIN SMALL LETTER A WITH ACUTE 110 case 0x00E2: return false; // LATIN SMALL LETTER A WITH CIRCUMFLEX 111 case 0x00E3: return true; // place holder to allow optimization of switch statement 112 case 0x00E4: return false; // LATIN SMALL LETTER A WITH DIAERESIS 113 case 0x00E5: return true; // place holder to allow optimization of switch statement 114 case 0x00E6: return false; // LATIN SMALL LETTER AE 115 case 0x00E7: return false; // LATIN SMALL LETTER C WITH CEDILLA 116 case 0x00E8: return false; // LATIN SMALL LETTER E WITH GRAVE 117 case 0x00E9: return false; // LATIN SMALL LETTER E WITH ACUTE 118 case 0x00EA: return false; // LATIN SMALL LETTER E WITH CIRCUMFLEX 119 case 0x00EB: return false; // LATIN SMALL LETTER E WITH DIAERESIS 120 case 0x00EC: return false; // LATIN SMALL LETTER I WITH GRAVE 121 case 0x00ED: return false; // LATIN SMALL LETTER I WITH ACUTE 122 case 0x00EE: return false; // LATIN SMALL LETTER I WITH CIRCUMFLEX 123 case 0x00EF: return false; // LATIN SMALL LETTER I WITH DIAERESIS 124 case 0x00F0: return true; // place holder to allow optimization of switch statement 125 case 0x00F1: return true; // place holder to allow optimization of switch statement 126 case 0x00F2: return false; // LATIN SMALL LETTER O WITH GRAVE 127 case 0x00F3: return false; // LATIN SMALL LETTER O WITH ACUTE 128 case 0x00F4: return false; // LATIN SMALL LETTER O WITH CIRCUMFLEX 129 case 0x00F5: return true; // place holder to allow optimization of switch statement 130 case 0x00F6: return false; // LATIN SMALL LETTER O WITH DIAERESIS 131 case 0x00F7: return true; // place holder to allow optimization of switch statement 132 case 0x00F8: return true; // place holder to allow optimization of switch statement 133 case 0x00F9: return false; // LATIN SMALL LETTER U WITH GRAVE 134 case 0x00FA: return false; // LATIN SMALL LETTER U WITH ACUTE 135 case 0x00FB: return false; // LATIN SMALL LETTER U WITH CIRCUMFLEX 136 case 0x00FC: return false; // LATIN SMALL LETTER U WITH DIAERESIS 137 case 0x00FD: return true; // place holder to allow optimization of switch statement 138 case 0x00FE: return true; // place holder to allow optimization of switch statement 139 case 0x00FF: return false; // LATIN SMALL LETTER Y WITH DIAERESIS 140 case 0x0100: return true; // place holder to allow optimization of switch statement 141 case 0x0101: return true; // place holder to allow optimization of switch statement 142 case 0x0102: return false; // LATIN CAPITAL LETTER A WITH BREVE 143 case 0x0103: return false; // LATIN SMALL LETTER A WITH BREVE 144 case 0x0104: return false; // LATIN CAPITAL LETTER A WITH OGONEK 145 case 0x0105: return false; // LATIN SMALL LETTER A WITH OGONEK 146 case 0x0106: return false; // LATIN CAPITAL LETTER C WITH ACUTE 147 case 0x0107: return false; // LATIN SMALL LETTER C WITH ACUTE 148 case 0x0108: return true; // place holder to allow optimization of switch statement 149 case 0x0109: return true; // place holder to allow optimization of switch statement 150 case 0x010A: return true; // place holder to allow optimization of switch statement 151 case 0x010B: return true; // place holder to allow optimization of switch statement 152 case 0x010C: return false; // LATIN CAPITAL LETTER C WITH CARON 153 case 0x010D: return false; // LATIN SMALL LETTER C WITH CARON 154 case 0x010E: return true; // place holder to allow optimization of switch statement 155 case 0x010F: return true; // place holder to allow optimization of switch statement 156 case 0x0110: return false; // LATIN CAPITAL LETTER D WITH STROKE 157 case 0x0111: return false; // LATIN SMALL LETTER D WITH STROKE 158 case 0x0112: return true; // place holder to allow optimization of switch statement 159 case 0x0113: return true; // place holder to allow optimization of switch statement 160 case 0x0114: return true; // place holder to allow optimization of switch statement 161 case 0x0115: return true; // place holder to allow optimization of switch statement 162 case 0x0116: return true; // place holder to allow optimization of switch statement 163 case 0x0117: return true; // place holder to allow optimization of switch statement 164 case 0x0118: return false; // LATIN CAPITAL LETTER E WITH OGONEK 165 case 0x0119: return false; // LATIN SMALL LETTER E WITH OGONEK 166 case 0x011A: return true; // place holder to enable table lookup 167 case 0x011B: return true; // place holder to enable table lookup 168 case 0x011C: return true; // place holder to enable table lookup 169 case 0x011D: return true; // place holder to enable table lookup 170 case 0x011E: return true; // place holder to enable table lookup 171 case 0x011F: return true; // place holder to enable table lookup 172 case 0x0120: return true; // place holder to enable table lookup 173 case 0x0121: return true; // place holder to enable table lookup 174 case 0x0122: return true; // place holder to enable table lookup 175 case 0x0123: return true; // place holder to enable table lookup 176 case 0x0124: return true; // place holder to enable table lookup 177 case 0x0125: return true; // place holder to enable table lookup 178 case 0x0126: return true; // place holder to enable table lookup 179 case 0x0127: return true; // place holder to enable table lookup 180 case 0x0128: return true; // place holder to enable table lookup 181 case 0x0129: return true; // place holder to enable table lookup 182 case 0x012A: return true; // place holder to enable table lookup 183 case 0x012B: return true; // place holder to enable table lookup 184 case 0x012C: return true; // place holder to enable table lookup 185 case 0x012D: return true; // place holder to enable table lookup 186 case 0x012E: return true; // place holder to enable table lookup 187 case 0x012F: return true; // place holder to enable table lookup 188 case 0x0130: return true; // place holder to enable table lookup 189 case 0x0131: return true; // place holder to enable table lookup 190 case 0x0132: return true; // place holder to enable table lookup 191 case 0x0133: return true; // place holder to enable table lookup 192 case 0x0134: return true; // place holder to enable table lookup 193 case 0x0135: return true; // place holder to enable table lookup 194 case 0x0136: return true; // place holder to enable table lookup 195 case 0x0137: return true; // place holder to enable table lookup 196 case 0x0138: return true; // place holder to enable table lookup 197 case 0x0139: return true; // place holder to enable table lookup 198 case 0x013A: return true; // place holder to enable table lookup 199 case 0x013B: return true; // place holder to enable table lookup 200 case 0x013C: return true; // place holder to enable table lookup 201 case 0x013D: return true; // place holder to enable table lookup 202 case 0x013E: return true; // place holder to enable table lookup 203 case 0x013F: return true; // place holder to enable table lookup 204 case 0x0140: return true; // place holder to enable table lookup 205 case 0x0141: return false; // LATIN CAPITAL LETTER L WITH STROKE 206 case 0x0142: return false; // LATIN SMALL LETTER L WITH STROKE 207 case 0x0143: return false; // LATIN CAPITAL LETTER N WITH ACUTE 208 case 0x0144: return false; // LATIN SMALL LETTER N WITH ACUTE 209 case 0x0145: return true; // place holder to enable table lookup 210 case 0x0146: return true; // place holder to enable table lookup 211 case 0x0147: return true; // place holder to enable table lookup 212 case 0x0148: return true; // place holder to enable table lookup 213 case 0x0149: return true; // place holder to enable table lookup 214 case 0x014A: return true; // place holder to enable table lookup 215 case 0x014B: return true; // place holder to enable table lookup 216 case 0x014C: return true; // place holder to enable table lookup 217 case 0x014D: return true; // place holder to enable table lookup 218 case 0x014E: return true; // place holder to enable table lookup 219 case 0x014F: return true; // place holder to enable table lookup 220 case 0x0150: return false; // LATIN CAPITAL LETTER O WITH DOUBLE ACUTE 221 case 0x0151: return false; // LATIN SMALL LETTER O WITH DOUBLE ACUTE 222 case 0x0152: return false; // LATIN CAPITAL LIGATURE OE 223 case 0x0153: return false; // LATIN SMALL LIGATURE OE 224 case 0x0154: return true; // place holder to enable table lookup 225 case 0x0155: return true; // place holder to enable table lookup 226 case 0x0156: return true; // place holder to enable table lookup 227 case 0x0157: return true; // place holder to enable table lookup 228 case 0x0158: return true; // place holder to enable table lookup 229 case 0x0159: return true; // place holder to enable table lookup 230 case 0x015A: return false; // LATIN CAPITAL LETTER S WITH ACUTE 231 case 0x015B: return false; // LATIN SMALL LETTER S WITH ACUTE 232 case 0x015C: return true; // place holder to enable table lookup 233 case 0x015D: return true; // place holder to enable table lookup 234 case 0x015E: return true; // place holder to enable table lookup 235 case 0x015F: return true; // place holder to enable table lookup 236 case 0x0160: return false; // LATIN CAPITAL LETTER S WITH CARON 237 case 0x0161: return false; // LATIN SMALL LETTER S WITH CARON 238 case 0x0162: return true; // place holder to enable table lookup 239 case 0x0163: return true; // place holder to enable table lookup 240 case 0x0164: return true; // place holder to enable table lookup 241 case 0x0165: return true; // place holder to enable table lookup 242 case 0x0166: return true; // place holder to enable table lookup 243 case 0x0167: return true; // place holder to enable table lookup 244 case 0x0168: return true; // place holder to enable table lookup 245 case 0x0169: return true; // place holder to enable table lookup 246 case 0x016A: return true; // place holder to enable table lookup 247 case 0x016B: return true; // place holder to enable table lookup 248 case 0x016C: return true; // place holder to enable table lookup 249 case 0x016D: return true; // place holder to enable table lookup 250 case 0x016E: return true; // place holder to enable table lookup 251 case 0x016F: return true; // place holder to enable table lookup 252 case 0x0170: return false; // LATIN CAPITAL LETTER U WITH DOUBLE ACUTE 253 case 0x0171: return false; // LATIN SMALL LETTER U WITH DOUBLE ACUTE 254 case 0x0172: return true; // place holder to enable table lookup 255 case 0x0173: return true; // place holder to enable table lookup 256 case 0x0174: return true; // place holder to enable table lookup 257 case 0x0175: return true; // place holder to enable table lookup 258 case 0x0176: return true; // place holder to enable table lookup 259 case 0x0177: return true; // place holder to enable table lookup 260 case 0x0178: return false; // LATIN CAPITAL LETTER Y WITH DIAERESIS 261 case 0x0179: return false; // LATIN CAPITAL LETTER Z WITH ACUTE 262 case 0x017A: return false; // LATIN SMALL LETTER Z WITH ACUTE 263 case 0x017B: return false; // LATIN CAPITAL LETTER Z WITH DOT ABOVE 264 case 0x017C: return false; // LATIN SMALL LETTER Z WITH DOT ABOVE 265 case 0x017D: return false; // LATIN CAPITAL LETTER Z WITH CARON 266 case 0x017E: return false; // LATIN SMALL LETTER Z WITH CARON 267 } 268 switch (c) { 269 case 0x0218: return false; // LATIN CAPITAL LETTER S WITH COMMA BELOW 270 case 0x0219: return false; // LATIN SMALL LETTER S WITH COMMA BELOW 271 case 0x021A: return false; // LATIN CAPITAL LETTER T WITH COMMA BELOW 272 case 0x021B: return false; // LATIN SMALL LETTER T WITH COMMA BELOW 273 case 0x021C: return true; // place holder to enable table lookup 274 case 0x201D: return false; // RIGHT DOUBLE QUOTATION MARK 275 case 0x201E: return false; // DOUBLE LOW-9 QUOTATION MARK 276 } 277 if (c == 0x20AC) return false; // EURO SIGN 278 return true; 279 280 } 281 282 283 }