Ejemplo
Solución
Utilice
javax.mail.internet.MimeBodyPart.setDescription (String, String) La serie Unicode dada se codificará utilizando el conjunto de caracteres especificado.
Advierta que el conjunto de caracteres especificado debe soportar todos los caracteres de la serie.
Si el lenguaje de la serie es desconocido, utilice iso-8859-1.

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("iso-8859-1"); //$NON-NLS-1$
java.io.FileOutputStream out = new java.io.FileOutputStream(
"Rule182-2.html", true); //$NON-NLS-1$
out.write(description);

} catch (Exception e) {
System.out.println(e.toString());
}

}

public static void main(String[] args) {
javax.mail.internet.MimeBodyPart mbp = new javax.mail.internet.MimeBodyPart();
try {
mbp.setDescription(args[0]);
byte[] description = mbp.getDescription().getBytes();
java.io.FileOutputStream out = new java.io.FileOutputStream(
"Rule.html", true); //$NON-NLS-1$
out.write(description);
} catch (Exception e) {
System.out.println(e.toString());
}
}