Lines Matching refs:charset
74 * yet a widely used charset, one might want to first charset-encode
75 * the String into another charset and then do the transfer-encoding.
119 * In addition, the <code>mail.mime.charset</code> System property can
120 * be used to specify the default MIME charset to use for encoded words
121 * and text parts that don't otherwise specify a charset. Normally, the
122 * default MIME charset is derived from the default Java charset, as
125 * charset. In cases where the default MIME charset to be used for
126 * mail messages is different than the charset used for files stored on
149 // cached map of whether a charset is compatible with ASCII
222 encoding = "base64"; // charset isn't compatible with ASCII
245 * Determine whether the charset in the Content-Type is compatible
246 * with ASCII or not. A charset is compatible with ASCII if the
249 * charset is not compatible with ASCII.
254 String charset = ct.getParameter("charset");
255 if (charset == null)
257 charset = charset.toLowerCase(Locale.ENGLISH);
260 bool = nonAsciiCharsetMap.get(charset);
264 byte[] b = "\r\n".getBytes(charset);
273 nonAsciiCharsetMap.put(charset, bool);
472 * default charset, then transfer-encoded using either the B or
513 * charset, then transfer-encoded using either the B or Q encoding.
521 * @param charset the charset. If this parameter is null, the
526 * encoded are in the ASCII charset, otherwise "B" encoding
529 * @exception UnsupportedEncodingException if the charset
532 public static String encodeText(String text, String charset,
535 return encodeWord(text, charset, encoding, false);
543 * RFC 2047, Section 6.1. If the charset-conversion fails
568 * @exception UnsupportedEncodingException if the charset
669 * default charset, then transfer-encoded using either the B or
695 * charset, then transfer-encoded using either the B or Q encoding.
700 * @param charset the MIME charset
704 * encoded are in the ASCII charset, otherwise "B" encoding
709 public static String encodeWord(String word, String charset,
712 return encodeWord(word, charset, encoding, true);
722 private static String encodeWord(String string, String charset,
732 // Else, apply the specified charset conversion.
734 if (charset == null) { // use default charset
735 jcharset = getDefaultJavaCharset(); // the java charset
736 charset = getDefaultMIMECharset(); // the MIME equivalent
737 } else // MIME charset -> java charset
738 jcharset = javaCharset(charset);
762 75 - 7 - charset.length(), // the available space
763 "=?" + charset + "?" + encoding + "?", // prefix
830 * charset-converted into Unicode. If the charset-conversion
837 * @exception UnsupportedEncodingException if the charset
847 // get charset
851 "encoded word does not include charset: " + eword);
852 String charset = eword.substring(start, pos);
853 int lpos = charset.indexOf('*'); // RFC 2231 language specified?
855 charset = charset.substring(0, lpos);
856 charset = javaCharset(charset);
907 // the specified charset
909 new String(bytes, 0, count, charset);
930 /* An unknown charset of the form ISO-XXX-XXX, will cause
937 throw new UnsupportedEncodingException(charset);
952 // find first '?' after opening '=?' - end of charset
1230 * Convert a MIME charset name into a valid Java charset name. <p>
1232 * @param charset the MIME charset name
1233 * @return the Java charset equivalent. If a suitable mapping is
1234 * not available, the passed in charset is itself returned.
1236 public static String javaCharset(String charset) {
1237 if (mime2java == null || charset == null)
1238 // no mapping table, or charset parameter is null
1239 return charset;
1241 String alias = mime2java.get(charset.toLowerCase(Locale.ENGLISH));
1242 return alias == null ? charset : alias;
1246 * Convert a java charset into its MIME charset name. <p>
1252 * @param charset the JDK charset
1254 * is not possible, the passed in charset itself
1258 public static String mimeCharset(String charset) {
1259 if (java2mime == null || charset == null)
1260 // no mapping table or charset param is null
1261 return charset;
1263 String alias = java2mime.get(charset.toLowerCase(Locale.ENGLISH));
1264 return alias == null ? charset : alias;
1271 * Get the default charset corresponding to the system's current
1272 * default locale. If the System property <code>mail.mime.charset</code>
1273 * is set, a system charset corresponding to this MIME charset will be
1276 * @return the default charset of the system's default locale,
1277 * as a Java charset. (NOT a MIME charset)
1283 * If mail.mime.charset is set, it controls the default
1284 * Java charset as well.
1288 mimecs = System.getProperty("mail.mime.charset");
1317 * Get the default MIME charset for this locale.
1322 defaultMIMECharset = System.getProperty("mail.mime.charset");
1330 // Tables to map MIME charset names to Java names and vice versa.
1331 // XXX - Should eventually use J2SE 1.4 java.nio.charset.Charset
1344 "/META-INF/javamail.charset.map");
1350 // Load the JDK-to-MIME charset mapping table
1353 // Load the MIME-to-JDK charset mapping table
1367 // the same as the default javamail.charset.map.
1468 * belong to the US-ASCII charset. MOSTLY_ASCII
1495 * belong to the US-ASCII charset. MOSTLY_ASCII
1539 * belong to the US-ASCII charset. MOSTLY_ASCII