Monday, March 31, 2003 03:24 AM
Firstly, if there is both Html and Plain text in a message, the plain text is just a texted version of the Html (tags removed). Most email clients do this so that the message can be read even if someone has Html messages switched off for security reasons. (At least I think this is the case).
Anyway, in answer to your question, in the dual case why not transform the plain text into Html and display that and the Html part. All you should need to worry about is adding
to the plain text every time you encounter a line seperator. Something like:
String plain = [the plain text];
String separator = System.getProperty("line.separator");
String plainAsHtml = plain.replaceAll( separator, "
" + separator);
This code is JDK1.4 specific as replaceAll uses the Pattern/Matcher classes behind the scenes to do the replacing.