1 17 18 22 23 package org.apache.geronimo.system.configuration; 24 25 34 public class Encodings 35 { 36 37 38 41 static final int DefaultLastPrintable = 0x7F; 42 43 46 static EncodingInfo getEncodingInfo(String encoding) { 47 if (encoding == null) 48 return new EncodingInfo(null, DefaultLastPrintable); 49 for (int i = 0; i < _encodings.length; i++) { 50 if (_encodings[i].name.equalsIgnoreCase(encoding)) 51 return _encodings[i]; 52 } 53 return new SieveEncodingInfo(encoding, DefaultLastPrintable); 54 } 55 56 static final String JIS_DANGER_CHARS 57 = "\\\u007e\u007f\u00a2\u00a3\u00a5\u00ac" 58 +"\u2014\u2015\u2016\u2026\u203e\u203e\u2225\u222f\u301c" 59 +"\uff3c\uff5e\uffe0\uffe1\uffe2\uffe3"; 60 61 64 private static final EncodingInfo[] _encodings = new EncodingInfo[] { 65 new EncodingInfo("ASCII", 0x7F), 66 new EncodingInfo("US-ASCII", 0x7F), 67 new EncodingInfo("ISO-8859-1", 0xFF), 68 new EncodingInfo("ISO-8859-2", 0xFF), 69 new EncodingInfo("ISO-8859-3", 0xFF), 70 new EncodingInfo("ISO-8859-4", 0xFF), 71 new EncodingInfo("ISO-8859-5", 0xFF), 72 new EncodingInfo("ISO-8859-6", 0xFF), 73 new EncodingInfo("ISO-8859-7", 0xFF), 74 new EncodingInfo("ISO-8859-8", 0xFF), 75 new EncodingInfo("ISO-8859-9", 0xFF), 76 80 new EncodingInfo("UTF-8", "UTF8", 0x10FFFF), 81 86 new SieveEncodingInfo("Shift_JIS", "SJIS", 0x7F, JIS_DANGER_CHARS), 87 90 new SieveEncodingInfo("Windows-31J", "MS932", 0x7F, JIS_DANGER_CHARS), 91 new SieveEncodingInfo("EUC-JP", null, 0x7F, JIS_DANGER_CHARS), 92 new SieveEncodingInfo("ISO-2022-JP", null, 0x7F, JIS_DANGER_CHARS), 93 }; 94 } 95 | Popular Tags |