Use
javax.mail.internet.MimeBodyPart.setSubject
(java.lang.String,
java.lang.String)
The given Unicode string will be encoded using the specified character set.
Note that the specified character set must support all characters in the string.
If the language of the string is unknown, use UTF-8.
public static void main(String[] args) {
String subject = args[0];
String charset = args[1];
javax.mail.internet.MimeMessage mm = new javax.mail.internet.MimeMessage(
java.mail.Session.getInstance(new java.util.Properties()));
try {
mm.setSubject(subject, charset);
byte[] description = mm.getSubject().getBytes("UTF-8");
java.io.FileOutputStream out = new java.io.FileOutputStream(
"Rule183-2.html", true);
out.write(description);
} catch (Exception e) {
System.out.println(e.toString());
}
}
|
|