Use
javax.mail.internet.MimeBodyPart.setDescription
(String,
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 text = args[0];
String charset = args[1];
javax.mail.internet.MimeBodyPart mbp = new javax.mail.internet.MimeBodyPart();
try {
mbp.setDescription(text, charset);
byte[] description = mbp.getDescription().getBytes("UTF-8");
java.io.FileOutputStream out = new java.io.FileOutputStream(
"Rule182-2.html", true);
out.write(description);
} catch (Exception e) {
System.out.println(e.toString());
}
}
|
|