Lines Matching refs:charset
63 * yet a widely used charset, one might want to first charset-encode
64 * the String into another charset and then do the transfer-encoding.
108 * In addition, the <code>mail.mime.charset</code> System property can
109 * be used to specify the default MIME charset to use for encoded words
110 * and text parts that don't otherwise specify a charset. Normally, the
111 * default MIME charset is derived from the default Java charset, as
114 * charset. In cases where the default MIME charset to be used for
115 * mail messages is different than the charset used for files stored on
392 * default charset, then transfer-encoded using either the B or
433 * charset, then transfer-encoded using either the B or Q encoding.
441 * @param charset the charset. If this parameter is null, the
446 * encoded are in the ASCII charset, otherwise "B" encoding
450 public static String encodeText(String text, String charset,
453 return encodeWord(text, charset, encoding, false);
461 * RFC 2047, Section 6.1.1. If the charset-conversion fails
485 * @exception UnsupportedEncodingException if the charset
563 * default charset, then transfer-encoded using either the B or
589 * charset, then transfer-encoded using either the B or Q encoding.
594 * @param charset the MIME charset
598 * encoded are in the ASCII charset, otherwise "B" encoding
603 public static String encodeWord(String word, String charset,
606 return encodeWord(word, charset, encoding, true);
616 private static String encodeWord(String string, String charset,
626 // Else, apply the specified charset conversion.
628 if (charset == null) { // use default charset
629 jcharset = getDefaultJavaCharset(); // the java charset
630 charset = getDefaultMIMECharset(); // the MIME equivalent
631 } else // MIME charset -> java charset
632 jcharset = javaCharset(charset);
656 75 - 7 - charset.length(), // the available space
657 "=?" + charset + "?" + encoding + "?", // prefix
719 * charset-converted into Unicode. If the charset-conversion
725 * @exception UnsupportedEncodingException if the charset
734 // get charset
738 String charset = javaCharset(eword.substring(start, pos));
778 // the specified charset
779 String s = new String(bytes, 0, count, charset);
796 /* An unknown charset of the form ISO-XXX-XXX, will cause
1043 * Convert a MIME charset name into a valid Java charset name. <p>
1045 * @param charset the MIME charset name
1046 * @return the Java charset equivalent. If a suitable mapping is
1047 * not available, the passed in charset is itself returned.
1049 public static String javaCharset(String charset) {
1050 if (mime2java == null || charset == null)
1051 // no mapping table, or charset parameter is null
1052 return charset;
1054 String alias = (String)mime2java.get(charset.toLowerCase());
1055 return alias == null ? charset : alias;
1059 * Convert a java charset into its MIME charset name. <p>
1065 * @param charset the JDK charset
1067 * is not possible, the passed in charset itself
1071 public static String mimeCharset(String charset) {
1072 if (java2mime == null || charset == null)
1073 // no mapping table or charset param is null
1074 return charset;
1076 String alias = (String)java2mime.get(charset.toLowerCase());
1077 return alias == null ? charset : alias;
1084 * Get the default charset corresponding to the system's current
1085 * default locale. If the System property <code>mail.mime.charset</code>
1086 * is set, a system charset corresponding to this MIME charset will be
1089 * @return the default charset of the system's default locale,
1090 * as a Java charset. (NOT a MIME charset)
1096 * If mail.mime.charset is set, it controls the default
1097 * Java charset as well.
1101 mimecs = SAAJUtil.getSystemProperty("mail.mime.charset");
1130 * Get the default MIME charset for this locale.
1134 defaultMIMECharset = SAAJUtil.getSystemProperty("mail.mime.charset");
1141 // Tables to map MIME charset names to Java names and vice versa.
1142 // XXX - Should eventually use J2SE 1.4 java.nio.charset.Charset
1155 "/META-INF/javamail.charset.map");
1160 // Load the JDK-to-MIME charset mapping table
1163 // Load the MIME-to-JDK charset mapping table
1170 // the same as the default javamail.charset.map.
1271 * belong to the US-ASCII charset. MOSTLY_ASCII
1298 * belong to the US-ASCII charset. MOSTLY_ASCII
1342 * belong to the US-ASCII charset. MOSTLY_ASCII