1 57 58 59 package org.enhydra.apache.xml.serialize; 60 61 62 63 64 73 public class Encodings 74 { 75 76 77 80 static final int DefaultLastPrintable = 0x7F; 81 82 85 static EncodingInfo getEncodingInfo(String encoding) { 86 if (encoding == null) 87 return new EncodingInfo(null, DefaultLastPrintable); 88 for (int i = 0; i < _encodings.length; i++) { 89 if (_encodings[i].name.equalsIgnoreCase(encoding)) 90 return _encodings[i]; 91 } 92 return new SieveEncodingInfo(encoding, DefaultLastPrintable); 93 } 94 95 static final String JIS_DANGER_CHARS 96 = "\\\u007e\u007f\u00a2\u00a3\u00a5\u00ac" 97 +"\u2014\u2015\u2016\u2026\u203e\u203e\u2225\u222f\u301c" 98 +"\uff3c\uff5e\uffe0\uffe1\uffe2\uffe3"; 99 100 103 private static final EncodingInfo[] _encodings = new EncodingInfo[] { 104 new EncodingInfo("ASCII", 0x7F), 105 new EncodingInfo("US-ASCII", 0x7F), 106 new EncodingInfo("ISO-8859-1", 0xFF), 107 new EncodingInfo("ISO-8859-2", 0xFF), 108 new EncodingInfo("ISO-8859-3", 0xFF), 109 new EncodingInfo("ISO-8859-4", 0xFF), 110 new EncodingInfo("ISO-8859-5", 0xFF), 111 new EncodingInfo("ISO-8859-6", 0xFF), 112 new EncodingInfo("ISO-8859-7", 0xFF), 113 new EncodingInfo("ISO-8859-8", 0xFF), 114 new EncodingInfo("ISO-8859-9", 0xFF), 115 119 new EncodingInfo("UTF-8", "UTF8", 0x10FFFF), 120 125 new SieveEncodingInfo("Shift_JIS", "SJIS", 0x7F, JIS_DANGER_CHARS), 126 129 new SieveEncodingInfo("Windows-31J", "MS932", 0x7F, JIS_DANGER_CHARS), 130 new SieveEncodingInfo("EUC-JP", null, 0x7F, JIS_DANGER_CHARS), 131 new SieveEncodingInfo("ISO-2022-JP", null, 0x7F, JIS_DANGER_CHARS), 132 }; 133 } 134 | Popular Tags |